Skip to content

Instantly share code, notes, and snippets.

@timbergus
Created June 19, 2013 07:43
Show Gist options
  • Save timbergus/5812357 to your computer and use it in GitHub Desktop.
Save timbergus/5812357 to your computer and use it in GitHub Desktop.
Basic node.js server without express, returning HTML contents instead plain text.
var http = require('http');
var port = 8080;
var server = http.createServer(function(request, response) {
response.writeHead(200, {'Content-Type': 'text/html'});
response.write('<h1>Hello World!</h1>');
response.end();
});
server.listen(port, function() {
console.log('Server working at http://localhost:' + port);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment