import "dotenv/config"; import express from "express"; import { configCheck, SERVER_PORT } from "./env.defaults"; configCheck(); declare global { namespace Express { export interface Request { userId: string; username: string; permissions: PermissionObject; } } } import { dataSource } from "./data-source"; dataSource.initialize(); const app = express(); import router from "./routes/index"; import { PermissionObject } from "./type/permissionTypes"; router(app); app.listen(SERVER_PORT, () => { console.log(`listening on *:${SERVER_PORT}`); }); import schedule from "node-schedule"; import RefreshCommandHandler from "./command/refreshCommandHandler"; const job = schedule.scheduleJob("0 0 * * *", async () => { console.log(`running Cron at ${new Date()}`); await RefreshCommandHandler.deleteExpired(); });