Created
May 14, 2019 16:00
-
-
Save mehdihettak/28f8ccaf26f38bfa086e93181205481d 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 port = 3000; | |
const requestHandler = (request, response) => { | |
/* console.log(request.url); | |
response.end('Bienvenue sur votre serveur !!'); */ | |
if (request.url === "/") { | |
response.end('Bienvenue sur votre serveur !!'); | |
} | |
if (request.url === "/contact") { | |
response.end('Nous ne sommes pas joignables pour le moment !'); | |
} | |
if (request.url === "/display/gerard") | |
response.end("Vous tentez d afficher le profil de Gerard"); | |
} | |
const server = http.createServer(requestHandler); | |
server.listen(port, (err) => { | |
if (err) { | |
throw new Error('Something bad happened...'); | |
} | |
console.log(`server is listening on ${port}`); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment