Apr 4, 2020

Textual description of firstImageUrl

How to create Express.js web application using Express Generator

The quickest way to get started with express application is to use Express Generator. Only pre-requisite is node.js should be installed to proceed further.
Step-1: Install exress-generator
m-c02z31rnlvdt:rap n0r0082$ npm install -g express-generator

Step-2: Create application using express-genrator.
Once express-generator is installed. Create express application 'client-app' using express-generator.
m-c02z31rnlvdt:rap n0r0082$ npx express-generator client-app

'client-app' skeleton is created with routes, views and placeholder for assets like images, css.
create : rap-client-app/
   create : client-app/public/
   create : client-app/public/javascripts/
   create : client-app/public/images/
   create : client-app/public/stylesheets/
   create : client-app/public/stylesheets/style.css
   create : client-app/routes/
   create : client-app/routes/index.js
   create : client-app/routes/users.js
   create : client-app/views/
   create : client-app/views/error.jade
   create : client-app/views/index.jade
   create : client-app/views/layout.jade
   create : client-app/app.js
   create : client-app/package.json
   create : client-app/bin/
   create : client-app/bin/www

: 'client-app' app is ready and server can be started. Default port number associated with server is 3000. It can be modified in file 'rap-client-app/bin/www' at line# 15.

Step-3: Install dependencies Go to folder client-app and install dependencies.
m-c02z31rnlvdt:rap n0r0082$ cd client-app
m-c02z31rnlvdt:client-app n0r0082$ npx express-generator client-app

Step-4: Start server.
m-c02z31rnlvdt:rap n0r0082$ npm start 
> rap-client-app@0.0.0 start /Users/n0r0082/rap/client-app
> node ./bin/www

GET / 200 777.042 ms - 170
GET /stylesheets/style.css 200 9.007 ms - 111
GET /favicon.ico 404 16.686 ms - 1452

Step-4: Once server is started. clinet-app can be accessed via http://localhost:3300/