ff-admin-server/src/index.ts

37 lines
988 B
TypeScript
Raw Normal View History

import "dotenv/config";
import express from "express";
import { configCheck, SERVER_PORT } from "./env.defaults";
configCheck();
2024-12-18 12:55:03 +01:00
import { PermissionObject } from "./type/permissionTypes";
declare global {
namespace Express {
export interface Request {
userId: string;
username: string;
2024-10-07 18:09:27 +02:00
isOwner: boolean;
2024-08-27 11:47:27 +02:00
permissions: PermissionObject;
2025-01-11 14:45:37 +01:00
isPWA: boolean;
2025-01-22 09:27:15 +01:00
isWebApiRequest: boolean;
}
}
}
import { dataSource } from "./data-source";
dataSource.initialize();
const app = express();
import router from "./routes/index";
router(app);
2024-10-21 10:38:14 +02:00
app.listen(process.env.NODE_ENV ? SERVER_PORT : 5000, () => {
2025-01-06 11:51:33 +01:00
console.log(`listening on *:${process.env.NODE_ENV ? SERVER_PORT : 5000}`);
});
2024-09-04 14:01:22 +02: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();
});