Created
June 19, 2013 07:43
-
-
Save timbergus/5812357 to your computer and use it in GitHub Desktop.
Basic node.js server without express, returning HTML contents instead plain text.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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