Advertisement
banyucenter

Untitled

Nov 5th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const http = require('http');
  2. var chalk = require('chalk');
  3.  
  4. const hostname = '127.0.0.1';
  5. const port = 3000;
  6.  
  7. const server = http.createServer((req, res) => {
  8.   res.statusCode = 200;
  9.   res.setHeader('Content-Type', 'text/html');
  10.   res.write('Hello World');
  11.   res.end();
  12. });
  13.  
  14. server.listen(port, hostname, () => {
  15.   console.log(`Server running at http://${hostname}:${port}/`);
  16.   console.log(chalk.blue('Hello') + ' World' + chalk.red('!'));
  17. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement