Created
November 12, 2018 16:51
-
-
Save jerzyyy/2839b5593598761be3238aeec0da81eb to your computer and use it in GitHub Desktop.
serveur http
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
var http = require('http'); | |
http.createServer(function (require, response) { | |
response.writeHead(200, {'Content-Type': 'text/html; charset=utf-8'}) | |
var url= require.url; | |
if(url ==='/about'){ | |
response.write(`<h1>What's up Dude?</h1>`) | |
response.end() | |
}else{ | |
response.write('<h1>Yo! How are you doing, man?</h1>'); | |
response.end()} | |
}).listen(3000, function(){ | |
console.log("server start at port 3000"); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment