server.js 444 B

12345678910111213141516171819
  1. const express = require('express');
  2. const path = require('path');
  3. const app = express();
  4. const webDir = path.join(__dirname, '..', 'web');
  5. app.use(express.static(webDir));
  6. app.get('/', (req, res) => {
  7. res.sendFile(path.join(webDir, 'index.html'));
  8. });
  9. const PORT = process.env.PORT || 3000;
  10. const HOST = process.env.HOST || '0.0.0.0';
  11. app.listen(PORT, HOST, () => {
  12. console.log(`Static server running on http://${HOST}:${PORT}`);
  13. });