#contents
*Prerequisite [#m0335973]
-CentOS installation (You can refer [[HowToUse/CentOS/6.5]])
-Ubuntu installation (You can refer [[HowToUse/UbuntuServer/14.04]])
-npm installation (You can refer [[HowToUse/npm/1.3]])
*Install&Setup [#b1cb2873]
** Install on Ubuntu [#dd012279]
:Step.1|
Execute the following command.
$ sudo apt-get nodejs
** Install on Cent OS [#obd9c2f3]
: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 [#e370cb42]
**Create sample program [#me7466f2]
: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:https://github.com/osssv/osssv-helloworld/blob/master/nodejs/0.10/sample_1/app.js]]
: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 [#z564795b]
:Step.1|
Install ejs.
$ npm install -g ejs
:Step.2|
Place sample code which uses ejs module. You can refer sample code from [[here:https://github.com/osssv/osssv-helloworld/tree/master/nodejs/0.10/sample_2]].
: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 [#d98d70a2]
S.Yatsuzuka
#back(back,center,0)