welcome: please sign in

Diff for "MemberManual/WebApplications/NodeJs"

Differences between revisions 1 and 2
Revision 1 as of 2014-04-30 07:42:48
Size: 1003
Editor: MattCarberry
Comment: Initial Commit
Revision 2 as of 2014-05-16 08:01:13
Size: 1940
Editor: MattCarberry
Comment: Added more information
Deletions are marked like this. Additions are marked like this.
Line 4: Line 4:
  Node.js is an application server based off of Google's V8 Javascript Engine. Quite a few popular frameworks have popped up around Node.js such as AngularJS and Backbone.js.  Node.js is an application server based off of Google's V8 Javascript Engine. Quite a few popular frameworks have popped up around Node.js such as AngularJS and Backbone.js.
Line 8: Line 8:
=== Request a port ===
 Request a !ProxiedServer port on bog as described in FirewallRules
Line 9: Line 12:
Make a directory for your website
{{{
 Make a directory for your website
 {{{#!highlight bash
Line 16: Line 19:
Download Node.js
{{{
 Download Node.js
 {{{#!highlight bash
Line 24: Line 27:
{{{  {{{#!highlight bash
Line 30: Line 33:
Cleanup Install Directory
{{{
 Cleanup Install Directory
 {{{#!highlight bash
mcarberry@bog:~/public_web/sitename/node-v0.10.26$ cd ../nodejs/
mcarberry@bog:~/public_web/sitename/nodejs$ cp -r usr/local/* .
mcarberry@bog:~/public_web/sitename/nodejs$ rm -r usr
mcarberry@bog:~/public_web/sitename/nodejs$ cd ..
mcarberry@bog:~/public_web/sitename$ rm -r node-v0.10.26/
}}}
Line 33: Line 42:
=== Test Install ===
 Change the port in this script (gleaned from [[http://howtonode.org/how-to-install-nodejs|here]]) to the one requested in the firewall rules and place it in ~/public_web/sitename/.
 {{{#!highlight js
var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello Node.js\n');
}).listen(8124, "127.0.0.1");
console.log('Server running at http://127.0.0.1:8124/');

What is Node.js

  • Node.js is an application server based off of Google's V8 Javascript Engine. Quite a few popular frameworks have popped up around Node.js such as AngularJS and Backbone.js.

How

Request a port

  • Request a ProxiedServer port on bog as described in FirewallRules

Get Node.js

  • Make a directory for your website
       1 mcarberry@bog:~$ mkdir ~/public_web/sitename
       2 mcarberry@bog:~$ mkdir ~/public_web/sitename/nodejs
       3 mcarberry@bog:~$ cd ~/public_web/sitename
    
    Download Node.js
       1 mcarberry@bog:~/public_web/sitename$ wget http://nodejs.org/dist/v0.10.26/node-v0.10.26.tar.gz
       2 mcarberry@bog:~/public_web/sitename$ tar -xf node-v0.10.26.tar.gz 
       3 mcarberry@bog:~/public_web/sitename$ cd node-v0.10.26/
    

Build Node.js

  •    1 mcarberry@bog:~/public_web/sitename/node-v0.10.26$ ./configure 
       2 mcarberry@bog:~/public_web/sitename/node-v0.10.26$ make
       3 mcarberry@bog:~/public_web/sitename/node-v0.10.26$ make install DESTDIR=~/public_web/sitename/nodejs
    
    Cleanup Install Directory
       1 mcarberry@bog:~/public_web/sitename/node-v0.10.26$ cd ../nodejs/
       2 mcarberry@bog:~/public_web/sitename/nodejs$ cp -r usr/local/* .
       3 mcarberry@bog:~/public_web/sitename/nodejs$ rm -r usr
       4 mcarberry@bog:~/public_web/sitename/nodejs$ cd ..
       5 mcarberry@bog:~/public_web/sitename$ rm -r node-v0.10.26/
    

Test Install

  • Change the port in this script (gleaned from here) to the one requested in the firewall rules and place it in ~/public_web/sitename/.

       1 var http = require('http');
       2 http.createServer(function (req, res) {
       3   res.writeHead(200, {'Content-Type': 'text/plain'});
       4   res.end('Hello Node.js\n');
       5 }).listen(8124, "127.0.0.1");
       6 console.log('Server running at http://127.0.0.1:8124/');
    

MemberManual/WebApplications/NodeJs (last edited 2014-05-18 02:50:36 by MattCarberry)