zisest

Untitled

Oct 16th, 2021
1,099
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const http = require('http');
  2.  
  3.  
  4. const port = 3000;
  5. const hostname = 'localhost'
  6.  
  7. const server = http.createServer((req, res) => {
  8.   res.statusCode = 200;
  9.   res.setHeader('Content-Type', 'text/plain');
  10.   res.end('Hello, World!\n');
  11.     console.log(req.headers['x-forwarded-for'] + ' = ' +
  12.      req.socket.remoteAddress + ' = ' + req.socket.localPort + ' = ' + req.socket.remotePort)
  13. });
  14.  
  15. server.listen(port, () => {
  16.   console.log(`Server running at http://${hostname}:${port}/`);
  17. });
RAW Paste Data