Node.js

m

concept

Node

running Javascript outside the browser

wrapper around V8

makes more js more useful for the context where people use Node

nonblocking library

filesystem

databases

event loop archetecture

single thread

only one thing happening at once

nonblocking

doesn't wait, moves to next task until call backed

nonblocking sockets

open

to push from server

mostly idle

conventional

app.js

modules

var

config

app.configure(function(){});

route

CRUD

// List

app.get('/documents.:format', function(req, res){});

res.render('index', {});

locals:{title:'Express'}

// Create

app.post('/documents.:format?', function(req, res){});

// Read

app.get('/documents/:id.:format?', function(req, res){});

// Update

app.put('/documents/:id.:format?', function(req, res){});

// Delete

app.del('/documents/:id.:format?', function(req, res){});

// Notice that Express uses del instead of delete

//Only listen on $ node app.js

if(!module.parent){}

app.listen(3000);

console.log("Express server listening on port %d", app.address().port)