const http = require('http');
const port = 3000;
const url = require('url');
const server = http.createServer((request, response) => {
if (request.url === '/') {
response.end('Bienvenue sur votre serveur !!');
} else if (request.url === '/contact') {
{
response.end('Nous ne sommes pas joignables pour le moment !');
};
} else {
{
const urlSplit = request.url.split('/')
const name = urlSplit[2]
response.end(Vous tentez d/afficher le profil de ${name})
};
}
});
server.listen(port, err => {
if (err) {
throw new Error('Something bad happened...');
}
console.log(server is listening on ${port});
});