May 2015
Beginner
220 pages
4h 16m
English
Node.js is considered a technology that you can use to write backend applications. As such, we need to perform various tasks. Thankfully, we have a bunch of helpful built-in modules at our disposal.
We already used the HTTP module. It's perhaps the most important one for web development because it starts a server that listens on a particular port:
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(9000, '127.0.0.1');
console.log('Server running at http://127.0.0.1:9000/');We have a createServer method that returns a new web server object. In most cases, we run the listen method. ...
Read now
Unlock full access