How to use the http-server.HTTPServer function in http-server

To help you get started, we’ve selected a few http-server examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github flatiron / blacksmith / lib / commands / preview.js View on Github external
module.exports = function () {
  winston.info("Executing command "+"preview".yellow);

  var HTTPServer = require('http-server').HTTPServer;
  var httpServer = new HTTPServer({
    root: './public/'
  });

  httpServer.log = winston.info;

  httpServer.listen(process.env.PORT || process.env.C9_PORT || 8080);

  process.on('SIGINT', function() {
    winston.warn('http-server stopped.'.red);
    process.exit(0);
  });
}

http-server

A simple zero-configuration command-line http server

MIT
Latest version published 2 years ago

Package Health Score

85 / 100
Full package analysis