In this section we review Node.js and NPM, the node package manager. We also setup a basic application and install dependencies, then configure Babel and Webpack to build and run a simple javascript application.
Here are a few basic examples of using Node.js and NPM.
Interactive Shell
$ node
> console.log('Hello World');
Hello World
Executing JavaScript file
$ echo "console.log('Hello World');" > hello.js
$ node hello.js
Hello World
Plain Node
$ node basic_web_server.js
Server running on port 8080.
with Express
$ npm install express
$ node static_file_server.js
Server running on port 8080.
$ cd helloworld-example
$ npm install
$ npm run build
$ npm run start
Server running on port 3000.