Star (-) Watch (-)

Blog

Installing Express First of all install Express.js as a global module:

$ npm install express -g If that fails:

$ sudo npm install express -g create an Express app: $ express –sessions –css stylus We want to have support for sessions, hence the –sessions option. Using –css, we specified that we would be using the Stylus CSS engine. If you are a Less fan, you can specify –css less. Not specifying the –css option will default to the plain vanilla CSS we all are familiar with.

$ls //List the files and folders app.js package.json public routes views

Then install the dependencies for the app: $ npm install $ ls app.js node_modules package.json public routes views That will install a bunch of modules used by the app. With that the base of the app is ready. It is already a working app. Let’s see what it outputs. Start the app:

$ node app Express server listening on port 3000

Then load http://localhost:3000/ in your browser.