Last active
February 14, 2024 14:49
-
-
Save alex-streza/33ea9f06ad7dfb587a84e267e385c7c6 to your computer and use it in GitHub Desktop.
Next.js App Router - trpc-openapi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// /app/api/[...trpc]/route.ts | |
/** | |
"trpc-openapi": "^1.2.0", | |
"@trpc/client": "next", | |
"@trpc/next": "next", | |
"@trpc/react-query": "next", | |
"@trpc/server": "next", | |
**/ | |
import { createOpenApiNextHandler } from "trpc-openapi"; | |
import { appRouter } from "@morrow/api"; | |
import { createTRPCOpenAPIContext } from "@morrow/api/src/trpc"; | |
const handler = createOpenApiNextHandler({ | |
router: appRouter, | |
createContext: createTRPCOpenAPIContext, | |
onError: undefined, | |
responseMeta: undefined, | |
}); | |
export { handler as GET, handler as POST }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment