// 1. go to nodejs.org api documentation and read how to use url.parse // 2. use parse url and show a different text for a custom url var http = require('http'); var url = require('url'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain; charset=UTF-8'}); var purl=url.parse(req.url,true); if(purl.pathname=='/test') res.end('Test'); // there is response.write and response.end // response.end('text') is response.write('text'), then response.end(); else res.end('Hello World\n'); }).listen(1337); console.log('Server running at http://127.0.0.1:1337/');