This commit is contained in:
Atridad Lahiji 2023-08-01 00:41:26 -06:00 committed by atridadl
parent c347e163ff
commit 38b777602e
No known key found for this signature in database
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 cors from "nextjs-cors";
@ -7,7 +7,7 @@ import { createTRPCContext } from "~/server/api/trpc";
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
// Setup CORS
cors(req, res);
await cors(req, res);
// Handle incoming OpenAPI requests
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
const handler = (req: NextApiRequest, res: NextApiResponse) => {
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.
*/
import { initTRPC, TRPCError } from "@trpc/server";
import { OpenApiMeta } from "trpc-openapi";
import type { OpenApiMeta } from "trpc-openapi";
import { Ratelimit } from "@upstash/ratelimit";
import superjson from "superjson";
import { env } from "~/env.mjs";