Hello World from OSS Silicon Valley
HowToUse/NodeJS/0.10
_ Prerequisite
- 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
_ 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 (2949d)