-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
227 additions
and
36 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import '@usevenice/app-config/register.node' | ||
|
||
import type {NextApiHandler} from 'next' | ||
import {createOpenApiNextHandler} from 'trpc-openapi' | ||
|
||
import {respondToCORS} from '@/lib-server' | ||
import {appRouter} from '@/lib-server/appRouter' | ||
|
||
import {createContext, onError} from '../trpc/[...trpc]' | ||
|
||
const handler = createOpenApiNextHandler({ | ||
// not sure why this cast is needed... | ||
router: appRouter as any, | ||
createContext, | ||
onError, | ||
}) | ||
|
||
export default (function trpcHandler(req, res) { | ||
if (respondToCORS(req, res)) { | ||
return | ||
} | ||
// allow the root document to work. | ||
if (!req.query['trpc']) { | ||
req.query['trpc'] = '' | ||
} | ||
return handler(req, res) | ||
} satisfies NextApiHandler) |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.