DEV Community

Ali Zulfaqar
Ali Zulfaqar

Posted on • Updated on

ExpressJS application generator

Introduction

Hello and welcome to my 2nd post, this post is to share how you can streamline your files and folder for Express application generator. With Express application generator, you can have your files and folder up in no time. And make sure you have the basic knowledge for setting up backend file and folder such as npm init to make server.js file as this is just a tool to help simplify the process of setting up express files and folder

Installation steps

In the project directory, you can run:

npx express-generator

and you will have the folder and files as below
.
├── app.js
├── bin
│ └── www
├── package.json
├── public
│ ├── images
│ ├── javascripts
│ └── stylesheets
│ └── style.css
├── routes
│ ├── index.js
│ └── users.js
└── views
├── error.pug
├── index.pug
└── layout.pug

7 directories, 9 files

After the files and folder has been created, run below command

npm install

this will install all require dependency package from package.json

npm start

to run the express file

Conclusion

For anyone who is interested to dive in ExpressJS without headache to create new model, controller and routes. I recommend use express generator to get a grip of how the files and folders are structured. From there you can get familiar on how ExpressJS works

Discussion (0)