I am using a bootstrap theme from a site called startbootstrap, which requires you to download a lot of packages, and has its very own unique folder structure. I would like to serve this frontend in an Express application using Node. I have a vague idea of what my folder structure should look like, a.k.a., I should be pulling things into and pointing things to the Public folder. However, I’m not too sure about the specifics. Not sure if I should incorporate gulp and travis. I am able to successfully run what I have so far, while also pulling in the Particles.js library, but I want to do more – I want to add a backend and serve up user and admin pages with express. How would I structure this?
Usual express server application layout looks like this:
assets
components
bootstrap
react
index.html
script.js
app.js
This is simplified example of structuring. Put all your static content into assets folder. And serve it with static
middleware:
// app.js
const app = express();
app.use(express.static(__dirname + '/assets'));
// Your app middlewares goes here
app.use(yourMiddleware1);
app.use(yourMiddleware2);
//...
app.use(yourMiddlewareN);
app.listen();