app.js 643 B

123456789101112131415161718192021
  1. const express = require("express");
  2. const bodyParser = require("body-parser");
  3. const app = express();
  4. const { stream_multiple } = require('./stream-multiple')
  5. const env = require('./env')
  6. app.use(
  7. bodyParser.urlencoded({ extended: false }),
  8. bodyParser.json(),
  9. express.static(__dirname + '/public'),
  10. );
  11. app.get('/', (req, res) => res.send(`
  12. <h1>Thanks Tomás Pollak</h1>
  13. <a href="/stream_files">Stream Multiple Files</a>
  14. `));
  15. app.get('/stream_multiple_files', (req, res) => stream_multiple(req, res, env._urls, env.stream_dir));
  16. let PORT = process.env.PORT || 3000;
  17. app.listen(PORT, console.log(`Main Server: ${PORT}`));