Skip to content

Latest commit

 

History

History
41 lines (37 loc) · 906 Bytes

File metadata and controls

41 lines (37 loc) · 906 Bytes

Setting Up an Universal JavaScript App Development Environment

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.

Basics

Here are a few basic examples of using Node.js and NPM.

Hello World with Node.js

Interactive Shell

$ node
> console.log('Hello World');
Hello World

Executing JavaScript file

$ echo "console.log('Hello World');" > hello.js
$ node hello.js
Hello World

Basic HTTP Server

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.

HelloWorld Application

$ cd helloworld-example
$ npm install 
$ npm run build
$ npm run start
Server running on port 3000.