Node.js for begginers – installation

To download Node.js go to https://nodejs.org/en/ and install proper version.

After package installation you must create directory on disk to store your project and init it.
Open console, browse to created folder and then type:
#npm init
Hit [Enter] if you accept default values or enter your own data.
This will create package.json file.

If you want to install additional package then you can use command
#npm install --save packagename
–save – this option will add to your project depended library

If you use
#npm install -g packagename
This will install package to global directory instead of single project.

First install nodemon.
#npm install -g nodemon
This tool is very useful because monitors changing file changes and you do not need to restart serer every time.

Then install express module
#npm install --save express

To use EJS template engine install
#npm install --save ejs

If you will be dealing with forms, then you need to install body-parser module
#npm install --save body-parser

If you want to validate form input then install express-validator module
#npm install --save express-validator

If you want more information then watch this tutorial: