Node.js Playground

Hello World

Copy the following code into the editor

var http = require('http');
var requestListener = function (req, res) {
  res.writeHead(200);
  res.end('Hello, World!');
}

var server = http.createServer(requestListener);
server.listen(3000, function() { console.log("Listening on port 3000")});

Launch with node app.js

Visit the server via the URL http://[[CLIENT_SUBDOMAIN]]-3000-[[KATACODA_HOST]].environments.katacoda.com/

Interested in writing your own Node.js scenarios and demos? Visit www.katacoda.com/teach

app.js