Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
833 B

  1. http = require('http');
  2. fs = require('fs');
  3. port = 3000;
  4. host = '127.0.0.1';
  5. server = http.createServer( function(req, res) {
  6. if (req.method == 'POST') {
  7. console.log("Handling POST request...");
  8. res.writeHead(200, {'Content-Type': 'text/html'});
  9. var body = '';
  10. req.on('data', function (data) {
  11. body += data;
  12. });
  13. req.on('end', function () {
  14. console.log("POST payload: " + body);
  15. res.end( body );
  16. });
  17. }
  18. else
  19. {
  20. console.log("Handling GET request...");
  21. res.writeHead(200, {'Content-Type': 'text/html'});
  22. var html = '<html><body>HTTP Server at http://' + host + ':' + port + '</body></html>';
  23. res.end(html);
  24. }
  25. });
  26. server.listen(port, host);
  27. console.log('Listening at http://' + host + ':' + port);