inital release

This commit is contained in:
obvtiger 2025-04-30 19:01:10 +02:00
commit 1d708c14cf
26 changed files with 34335 additions and 0 deletions

35
server.js Normal file
View file

@ -0,0 +1,35 @@
const express = require("express");
const app = express();
const enableWs = require("express-ws");
const fs = require("fs");
const path = require("path");
require("dotenv").config();
enableWs(app);
const createCacheManager = require("./middleware/cacheManager");
app.use(createCacheManager());
const videoHostDir = path.join(__dirname, "videohost");
if (!fs.existsSync(videoHostDir)) {
fs.mkdirSync(videoHostDir);
console.log("Created videohost directory");
}
const routesPath = path.join(__dirname, "routes");
fs.readdirSync(routesPath).forEach((file) => {
if (file.endsWith(".js")) {
const routeHandler = require(path.join(routesPath, file));
routeHandler(app);
console.log(`Loaded route handler: ${file}`);
}
});
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
console.log(`Server is running on http://localhost:${PORT}`);
process.on("SIGINT", () => {
console.log("Shutting down repiped...");
process.exit(0);
});
});