Setting up your first basic node.js web application

Setting up a basic node.js web application on Ubuntu

This really the first thing to try after you've installed node.js on Ubuntu.


Install the express & nodemon node.js modules

npm install express -g
npm install nodemon -g


Make a directory & change to that directory

mkdir /home/webapp/node
cd /home/webapp/node


Create an express node.js application

express testapp
cd testapp


Start the node.js test web application

nodemon app.js

this should return something like.. indicating success

10 Jul 06:48:03 - [nodemon] v0.7.8
10 Jul 06:48:03 - [nodemon] to restart at any time, enter `rs`
10 Jul 06:48:03 - [nodemon] watching: /home/webapp/node/test-app
10 Jul 06:48:03 - [nodemon] starting `node app.js`
Express server listening on port 3000


check that it is running OK with web browser

http://xxx.xxx.xxx.xxx:3000/

You should see the basic 'Welcome to Express' page.

Congratualtions... your first node.js steps!!