Guest User

Untitled

a guest
Dec 12th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. #!/usr/bin/env node
  2.  
  3. var colors = require('colors'),
  4. httpServer = require('../lib/http-server';
  5.  
  6.  
  7. var port = 8080,
  8. host = '0.0.0.0',
  9. log = console.log;
  10.  
  11. var options = {
  12. root: './app',
  13. autoIndex: true,
  14. cache: false
  15. };
  16.  
  17. function onListening() {
  18. log('Starting up http-server, serving '.yellow
  19. + server.root.cyan
  20. + ' on port: '.yellow
  21. + port.toString().cyan);
  22. log('Hit CTRL-C to stop the server');
  23. }
  24.  
  25. var server = httpServer.createServer(options);
  26. server.listen(port, host, onListening);
  27.  
  28. if (process.platform !== 'win32') {
  29. //
  30. // Signal handlers don't work on Windows.
  31. //
  32. process.on('SIGINT', function () {
  33. log('http-server stopped.'.red);
  34. process.exit();
  35. });
  36. }
Add Comment
Please, Sign In to add comment