Created
November 22, 2015 18:03
-
-
Save merlindorin/1df028cef22254b8986a to your computer and use it in GitHub Desktop.
Serveur Http Avec listener séparé
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'); | |
const PORT=8080; | |
function requestListener(request, response){ | |
response.end('Hello World'); | |
} | |
var server = http.createServer(); | |
server.on('request', requestListener); | |
server.on('listening', function(){ | |
console.log("Server listening on `http://localhost:%s`", PORT); | |
}); | |
server.listen(PORT); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment