ExpressJS application generator

Use the application generator tool, express, to quickly create an application skeleton.

Install it with the following command. Make sure do globally(-g), otherwise we may face issue like: 'express' is not recognized as an internal or external command, operable program or batch file.

npm install express-generator -g

For example, the following creates an Express app named myapp in the current working directory.

express myapp
	create : ExpApp								//Main Project folder
	create : ExpApp/package.json						//Entries for dependencies like pom.xml for maven
	create : ExpApp/app.js							//Main execution starts from here
	create : ExpApp/public							//Main folder resources like javascript, images and stylesheet
	create : ExpApp/routes							//Main folder for routers- files will be executed based on router from this folder
	create : ExpApp/routes/index.js						//Index router
	create : ExpApp/routes/users.js						//User router
	create : ExpApp/views							//view folder UI design
	create : ExpApp/views/index.jade					//index page
	create : ExpApp/views/layout.jade					//layout page
	create : ExpApp/views/error.jade					//error page
	create : ExpApp/public/javascripts					//javascript folder
	create : ExpApp/public/images						//images folder					
	create : ExpApp/public/stylesheets					//stylesheets folder
	create : ExpApp/public/stylesheets/style.css				//css
	create : ExpApp/bin
	create : ExpApp/bin/www

The generated app directory structure looks like the following.

Express App wokspace

Do install for dependencies:

cd myapp
npm install

Once install succesfull use below command to start application

npm start

Then hit this url http://localhost:3000/ in browser to access the app.

Express generator result