server.js 563 B

1234567891011121314151617
  1. const http = require('http');
  2. const { SimpleServerHelper } = require('./SimpleServerHelper.js');
  3. const port = process.env.PORT || 2222;
  4. const verbose = process.env.VERBOSE || false // To log errors and files accessed
  5. const config = {
  6. publicFolder: 'public',
  7. htmlIndexPath: 'public/index.html',
  8. html404Path: 'public/404.html',
  9. verbose
  10. };
  11. const server = http.createServer((request, response) => {
  12. new SimpleServerHelper(config, request, response).respond();
  13. });
  14. server.listen(port, '127.0.0.1');
  15. console.info(`Server running on port ${port}`)