Hello World from OSS Silicon Valley


HowToUse/NodeJS/0.10

_ Prerequisite

_ Install&Setup

_ Install on Ubuntu

Step.1
Execute the following command.
$ sudo apt-get nodejs

_ Install on Cent OS

Step.1
Execute the following command.
$ curl --silent --location https://rpm.nodesource.com/setup_7.x | bash -
$ sudo yum install nodejs
Step.2
Install utilities.
$ sudo yum install npm

_ HowToUse

_ Create sample program

Step.1
Create your project directory.
$ mkdir <project name>
$ cd <project name>
Step.2
Place your sample code.
$ vi app.js

You can refer sample code from here

Step.3
Launch HTTP server.
$ node app.js

Then you should be able to access your application from http://<host IP>:<port num>/. The upper sample program listens 1337 as a port.

_ Use EJS template engine

Step.1
Install ejs.
$ npm install -g ejs
Step.2
Place sample code which uses ejs module. You can refer sample code from here.
Step.3
Launch HTTP server.
$ node app.js

Then you should be able to access your application from http://<host IP>:<port num>/. The upper sample program listens 1337 as a port.

_ Author

S.Yatsuzuka

[ back ]
Last-modified: 2017-01-25 (Wed) 07:59:18 (2641d)