Thursday 3 October 2013

hello world app with node.js and express.js

requires node and express to be installed (see here for instructions)

go to the root directory where your hello world app will be created
$ cd ~/src/web

create an express app called 'helloWorld' (and use the less css tool)
$ express helloWorld -c less

obtain  the required dependencies and install
$ cd helloWorld
$ npm install

run the server
$ npm start # npm calls 'node app'

add nodemon to our devDependencies so the server gets restarted automatically during development
$ vim package.json  

add the following
"devDependencies": {
    "nodemon": "*"
}

change the scripts / start value:    
"start": "nodemon app.js"

download dependency nodemon
$ npm install

start the server via nodemon
$ npm start

No comments:

Post a Comment