Created
September 19, 2015 17:37
-
-
Save timstott/52417efa3b0069e76ef2 to your computer and use it in GitHub Desktop.
Basic node.js server
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
#!/usr/bin/env node | |
var http = require('http'); | |
// Port to listen on | |
const PORT=8085; | |
// Function handling request and response | |
function handleRequest(request, response){ | |
console.log(request); | |
response.end('OK'); | |
} | |
// Create a server | |
var server = http.createServer(handleRequest); | |
// Start server | |
server.listen(PORT, function(){ | |
console.log("Server listening on: http://localhost:%s", PORT); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment