Advertisement
easternnl

My First Node Application

Sep 24th, 2018
533
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var http = require("http");
  2. http.createServer(function (request, response) {
  3.    // Send the HTTP header
  4.    // HTTP Status: 200 : OK
  5.    // Content Type: text/plain
  6.    response.writeHead(200, {'Content-Type': 'text/plain'});
  7.    
  8.    // Send the response body as "Hello World"
  9.    response.end('Hello World from Erik\n');
  10. }).listen(8081);
  11.  
  12. // Console will print the message
  13. console.log('Server running at http://127.0.0.1:8081/');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement