Created
November 13, 2018 11:06
-
-
Save par38/24fbd4c3adddd2dc46113fc2cd442790 to your computer and use it in GitHub Desktop.
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
const http = require('http'); | |
const url = require('url'); | |
const server = http.createServer((request, response) => { | |
let path = request.url; | |
console.log(path); | |
response.writeHead(200, { | |
'Content-type':'text/html; charset=utf-8'}) | |
if (path == '/') { | |
response.write('Bienvenue sur votre serveur !!'); | |
} else if (path == '/contact') { | |
response.write('Nous ne sommes pas joignables pour le moment !'); | |
} else if (path.includes('/display/')) { | |
response.write(`Vous tentez d’afficher le profil de ${path.slice(9)}`); | |
} | |
response.end(); | |
}); | |
server.listen(3000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment