Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/openstatusHQ/openstatus. ๐ซ Status page with uptime monitoring & API monitoring as code ๐ซ openstatus.dev
bun drizzle-orm monitoring monitoring-as-code nextjs observability on-call open-source shadcn-ui status-page statuspage synthetic-monitoring tinybird turso uptime uptime-checker uptime-monitor
Something went wrong. Try again.
TypeScript
at main
123456789101112131415161718192021222324252627import { appRouter, createTRPCContext } from "@openstatus/api";import { createTRPCOnError } from "@openstatus/api/src/trpc-errors";import { fetchRequestHandler } from "@trpc/server/adapters/fetch";import type { NextRequest } from "next/server";
import { auth } from "@/lib/auth";import { guardTRPCSource } from "@/lib/trpc/shared";
// Runs on the Node.js runtime (Vercel Fluid compute). The whole tRPC surface// is served here โ several routers pull Node-only deps (@slack/web-api, email// and notification SDKs) that are not Edge-safe.
const handler = (req: NextRequest) => { const blocked = guardTRPCSource(req); if (blocked) return blocked;
return fetchRequestHandler({ endpoint: "/api/trpc/lambda", router: appRouter, req: req, createContext: () => createTRPCContext({ req, auth }), onError: createTRPCOnError("lambda"), });};
export { handler as GET, handler as POST };