fosrl.pangolin/server/index.ts

37 lines
902 B
TypeScript
Raw Normal View History

import { runSetupFunctions } from "./setup";
2024-12-07 22:07:13 -05:00
import { createApiServer } from "./apiServer";
import { createNextServer } from "./nextServer";
import { createInternalServer } from "./internalServer";
2025-03-23 17:11:48 -04:00
import { Session, User, UserOrg } from "./db/schemas/schema";
2024-12-07 22:07:13 -05:00
async function startServers() {
2024-12-22 12:33:49 -05:00
await runSetupFunctions();
2024-12-07 22:07:13 -05:00
// Start all servers
const apiServer = createApiServer();
const internalServer = createInternalServer();
2024-12-25 15:49:35 -05:00
const nextServer = await createNextServer();
return {
apiServer,
nextServer,
internalServer,
};
2024-12-07 22:07:13 -05:00
}
2024-10-03 20:55:54 -04:00
2024-12-07 22:07:13 -05:00
// Types
2024-10-26 17:19:10 -04:00
declare global {
namespace Express {
interface Request {
user?: User;
session?: Session;
userOrg?: UserOrg;
userOrgRoleId?: number;
userOrgId?: string;
userOrgIds?: string[];
}
2024-10-03 20:55:54 -04:00
}
2024-10-26 17:19:10 -04:00
}
2024-12-07 22:07:13 -05:00
startServers().catch(console.error);