public
Created

node.js concepts asychrounous

  • Download Gist
no-continuation.js
JavaScript
1 2 3 4 5
app.post('/session/new',function(request, response){
var session = request.body;
save_session(session)
response.render('session_form')
});
save-with-continuation.js
JavaScript
1 2 3 4 5 6
app.post('/session/new',function(request, response){
var session = request.body;
save_session(session, function(){
response.render('session_form');
});
});
webserver.js
JavaScript
1 2 3 4 5 6
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.