22 lines
448 B
JavaScript
22 lines
448 B
JavaScript
const express = require("express");
|
|
const path = require("path");
|
|
const app = express();
|
|
const port = 3000;
|
|
|
|
app.use(express.static(path.join(__dirname, "public")));
|
|
|
|
app.get("/videos/:key", (req, res) => {
|
|
const filePath = path.join(
|
|
__dirname,
|
|
"public",
|
|
"videos",
|
|
req.params.key,
|
|
"output.m3u8",
|
|
);
|
|
res.sendFile(filePath);
|
|
});
|
|
|
|
app.listen(port, () => {
|
|
console.log(`Server is running at http://localhost:${port}`);
|
|
});
|