SHARE
TWEET

Untitled

a guest Oct 21st, 2019 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // content of index.js
  2. const http = require('http')
  3. const port = 3000
  4.  
  5. const requestHandler = (request, response) => {
  6.   console.log(request.url)
  7.   response.end('Hello Node.js Server!')
  8. }
  9.  
  10. const server = http.createServer(requestHandler)
  11.  
  12. server.listen(port, (err) => {
  13.   if (err) {
  14.     return console.log('something bad happened', err)
  15.   }
  16.  
  17.   console.log(`server is listening on ${port}`)
  18. })
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top