Skip to content

Instantly share code, notes, and snippets.

@elpuas
Last active April 1, 2021 20:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elpuas/676f27bb177804f220abb384ab14d592 to your computer and use it in GitHub Desktop.
Save elpuas/676f27bb177804f220abb384ab14d592 to your computer and use it in GitHub Desktop.
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