JavaScript and Node.js

Material to Cover

What is node.js?

Installing is really easy...

So what? Well, Node.js offers...

Quick Example

What exactly is Node.js?

Plenty of wheels for you already...

Project Boilerplate

./node-web-boilerplate/

node_modules/ - automatically managed by NPM
package.json - tells NPM what to do
config/ - .js files that configure things
scripts/ - place for helper scripts, githook scripts
Makefile - automates much for us

public/ - static files, publicly available via HTTP
views/ - dynamic template files for HTML views
server.js - main code file for our node.js server
app/ - place for additional server-side .js code

package.json

// ...
"dependencies": {
    "express": "2.5.11",    // node.js web application framework
    "underscore": "1.4.1",  // JS helper lib
    "swig": ">= 0.12.0"     // django-like HTML templates
},
"devDependencies": {
    "nodelint": "0.6.2",    // linting
    "nodeunit": "0.7.4"     // unit tests
},
// ...

JS Code Unit Testing

JS Code Linting

Automate NPM, Testing, and Linting

Node.js Web Server with Express

Client-Server Code Sharing

Client-Compatible Node.js Code Files

Realtime, WebSockets

WebSockets Example Server

WebSockets Example Client

Just for fun... Apestronauts

Thanks!