This commit is contained in:
Atridad Lahiji 2023-08-01 00:41:26 -06:00
parent a220d59bf9
commit 78aa16cded
No known key found for this signature in database
GPG key ID: 7CB8245F56BC3880
3 changed files with 6 additions and 6 deletions

View file

@ -1,4 +1,4 @@
import { NextApiRequest, NextApiResponse } from "next"; import type { NextApiRequest, NextApiResponse } from "next";
import { createOpenApiNextHandler } from "trpc-openapi"; import { createOpenApiNextHandler } from "trpc-openapi";
import cors from "nextjs-cors"; import cors from "nextjs-cors";
@ -7,7 +7,7 @@ import { createTRPCContext } from "~/server/api/trpc";
const handler = async (req: NextApiRequest, res: NextApiResponse) => { const handler = async (req: NextApiRequest, res: NextApiResponse) => {
// Setup CORS // Setup CORS
cors(req, res); await cors(req, res);
// Handle incoming OpenAPI requests // Handle incoming OpenAPI requests
return createOpenApiNextHandler({ return createOpenApiNextHandler({

View file

@ -1,10 +1,10 @@
import { NextApiRequest, NextApiResponse } from 'next'; import type { NextApiRequest, NextApiResponse } from "next";
import { openApiDocument } from '../../server/openapi'; import { openApiDocument } from "../../server/openapi";
// Respond with our OpenAPI schema // Respond with our OpenAPI schema
const handler = (req: NextApiRequest, res: NextApiResponse) => { const handler = (req: NextApiRequest, res: NextApiResponse) => {
res.status(200).send(openApiDocument); res.status(200).send(openApiDocument);
}; };
export default handler; export default handler;

View file

@ -67,7 +67,7 @@ export const createTRPCContext = async (opts: CreateNextContextOptions) => {
* This is where the tRPC API is initialized, connecting the context and transformer. * This is where the tRPC API is initialized, connecting the context and transformer.
*/ */
import { initTRPC, TRPCError } from "@trpc/server"; import { initTRPC, TRPCError } from "@trpc/server";
import { OpenApiMeta } from "trpc-openapi"; import type { OpenApiMeta } from "trpc-openapi";
import { Ratelimit } from "@upstash/ratelimit"; import { Ratelimit } from "@upstash/ratelimit";
import superjson from "superjson"; import superjson from "superjson";
import { env } from "~/env.mjs"; import { env } from "~/env.mjs";