import "dotenv/config"; import express from "express"; import { configCheck, SERVER_PORT } from "./env.defaults"; configCheck(); import { PermissionObject } from "./type/permissionTypes"; declare global { namespace Express { export interface Request { userId: string; username: string; isOwner: boolean; permissions: PermissionObject; } } } import { dataSource } from "./data-source"; dataSource.initialize(); const app = express(); import router from "./routes/index"; router(app); app.listen(process.env.NODE_ENV ? SERVER_PORT : 5000, () => { 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(); });