Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
July 16, 2021 06:31 am GMT

Simplify expressjs file with express application generator

Streamline express folder structure across all projects

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


Original Link: https://dev.to/alizulfaqar/simplify-expressjs-file-with-express-application-generator-1n1e

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To