multi-downloader-nx_mirror/gui/server/index.ts
AnidlSupport cd62595518 New GUI
2023-02-27 21:20:06 +01:00

29 lines
No EOL
688 B
TypeScript

import express from 'express';
import { ensureConfig, loadCfg, workingDir } from '../../modules/module.cfg-loader';
import cors from 'cors';
import ServiceHandler from './serviceHandler';
import open from 'open';
import path from 'path';
process.title = 'AniDL';
ensureConfig();
const cfg = loadCfg();
const app = express();
export { app, cfg };
app.use(express.json());
app.use(cors());
app.use(express.static(path.join(workingDir, 'gui', 'server', 'build'), { maxAge: 1000 * 60 * 20 }))
const server = app.listen(cfg.gui.port, () => {
console.log(`[INFO] GUI server started on port ${cfg.gui.port}`);
});
new ServiceHandler(server);
open(`http://localhost:${cfg.gui.port}`);