Resources
| JS compatibility (For Node.JS) | Node Green |
| MVC framework | Express |
| Theme Engine | JADE Language - Node Template Engine EJS - Embedded JavaScript Templating |
| DB/ORM/ODM | MongoDB Monogoose |
| HTTP reverse proxy server | NGINX |
| Desktop GUI | node-webkit |
Setting up a Node development environment
See: MDN’s Setting up a Node development environment
See also: Development Linux PC setup notes
In Ubuntu (18.x), type
$ sudo apt install nodejs $ node -v v8.10.0 $ sudo apt install npm $ npm -v 3.5.2
Create New NodeJS Project
$ mkdir -p ~/Documents/nodejs/webscraptest
$ cd ~/Documents/nodejs/webscraptest
$ npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.
See `npm help json` for definitive documentation on these fields
and exactly what they do.
Use `npm install <pkg> --save` afterwards to install a package and
save it as a dependency in the package.json file.
Press ^C at any time to quit.
name: (webscraptest)
version: (1.0.0)
description: A test for web scraping
entry point: (index.js)
test command:
git repository:
keywords:
author:
license: (ISC)
About to write to /home/badbuta/NodeJS-Proj/webscraptest/package.json:
{
"name": "webscraptest",
"version": "1.0.0",
"description": "A test for web scraping",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
Is this ok? (yes)
Then, a package.json is created.
Create a sample index.js:
console.log("Hello");
To start the node program:
$ node index.js
In order to use npm to start the program:
Edit the package.json:
{
"name": "webscraptest",
"version": "1.0.0",
"description": "A test for web scraping",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node index.js"
},
"author": "",
"license": "ISC"
}
Then start via npm:
$ npm run start -OR- $ npm start