Last active
April 1, 2021 20:56
-
-
Save elpuas/676f27bb177804f220abb384ab14d592 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 server = http.createServer( ( req, res ) => { | |
console.log( req.url ) | |
switch( req.url ) { | |
case '/': | |
res.end( 'The Homepage' ) | |
break; | |
case '/about': | |
res.end( 'The About Page' ) | |
break; | |
case '/contact': | |
res.end( 'The Contact Page' ) | |
break; | |
default: | |
res.writeHead( 404 ) | |
res.end() | |
} | |
} ) | |
server.listen(3000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment