10. • Runs high-performance server-side JavaScript
• Uses the Google Chrome V8 engine
• just-in-time compilation to machine code
• generation garbage collection (like the Java JVM)
• creates virtual “classes” to optimise property lookups
• Has a well-designed module system for third party code - very
effective and simple to use
• Your code runs in a single non-blocking JavaScript
thread
• That’s OK, most of the time you’re waiting for database or
network events
12. Node.js Web Server
var http = require('http');
var server = http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello Worldn');
})
server.listen(1337, "127.0.0.1");
console.log('Server running at http://127.0.0.1:1337');
13. JavaScript: an eligible bachelor?
avoid slow, validate forms
date ECMA, jQuery
marry Node.js, Crockford
17. Node.js does what it says on the tin
• High performance • callback spaghetti is not a
problem in practice
• High throughput
• Low CPU usage • use functional style
• Constant memory usage • client-side code is far
more difficult
• leaks will kill, but then • Don't do CPU intensive stuff
• < 100ms startup time • ... there's a warning on
• means you may not the tin!
notice!