ff-admin-server/src/index.ts

36 lines
875 B
TypeScript
Raw Normal View History

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;
2024-10-07 16:09:27 +00:00
isOwner: boolean;
2024-08-27 09:47:27 +00:00
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}`);
});
2024-09-04 12:01:22 +00:00
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();
});