Last active
August 29, 2015 14:27
-
-
Save aderonkeakinyemi/2bb9c59aac14df96fb70 to your computer and use it in GitHub Desktop.
My Server Assignment
This file contains 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
//importing the HTTP module | |
var http = require('http'); | |
//Defining the port that i want to listen to | |
const PORT=8080; | |
//a function that handles requests and sends response | |
function handleRequest(request, response){ | |
response.end('Hello World'); | |
} | |
//Creating a server | |
var server = http.createServer(handleRequest); | |
//starting the server | |
server.listen(PORT, function(){ | |
//Callback triggered when server is successfully listening. Hurray! | |
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