Express Js Scaffolding

Scaffolding is the process of creating the skeleton of the project. In simple terms, the arrangement of different types of files in various folders. For example, managing all the CSS files, js files that we want to be public, in the public folder, different routes in the routes folder, and images in a separate folder.

Scaffolder is the tool used to automate this task. A popular scaffolder for Express Js is an express-generator.

To use the express-generator, run the following command :

The folder structure of the project was created using express-generator

Folder Structure

  1. Routes: This folder contains various routes of the application, divided in different files.
  2. Public: This folder contains the files we want to be public like images and CSS files.
  3. Views: Views folder contains different templating files that we want to serve.
  4. app.js: This is the place where all the code is managed. It handles all the other files.

Leave a Reply

Your email address will not be published. Required fields are marked *