HackingFactory-v2 / server /routers.ts
FECUOY's picture
Initial commit: HackingFactory v2 Enhanced with Self-Refining AI features
4c41b3d
import { COOKIE_NAME } from "@shared/const";
import { getSessionCookieOptions } from "./_core/cookies";
import { systemRouter } from "./_core/systemRouter";
import { publicProcedure, router } from "./_core/trpc";
import { projectsRouter } from "./routers/projects";
import { filesRouter } from "./routers/files";
import { chatRouter } from "./routers/chat";
export const appRouter = router({
// if you need to use socket.io, read and register route in server/_core/index.ts, all api should start with '/api/' so that the gateway can route correctly
system: systemRouter,
auth: router({
me: publicProcedure.query(opts => opts.ctx.user),
logout: publicProcedure.mutation(({ ctx }) => {
const cookieOptions = getSessionCookieOptions(ctx.req);
ctx.res.clearCookie(COOKIE_NAME, { ...cookieOptions, maxAge: -1 });
return {
success: true,
} as const;
}),
}),
projects: projectsRouter,
files: filesRouter,
chat: chatRouter,
});
export type AppRouter = typeof appRouter;