-
-
Notifications
You must be signed in to change notification settings - Fork 86
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
5 changed files
with
34 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { fetchRequestHandler } from '@trpc/server/adapters/fetch'; | ||
import type { NextRequest } from 'next/server'; | ||
|
||
import { pino } from '@/libs/logger'; | ||
import { edgeRouter } from '@/server/routers'; | ||
|
||
export const runtime = 'edge'; | ||
|
||
const handler = (req: NextRequest) => | ||
fetchRequestHandler({ | ||
endpoint: '/trpc/edge', | ||
|
||
onError: ({ error, path }) => { | ||
pino.info(`Error in tRPC handler (edge) on path: ${path}`); | ||
console.error(error); | ||
}, | ||
|
||
req, | ||
router: edgeRouter, | ||
}); | ||
|
||
export { handler as GET, handler as POST }; |
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,5 @@ | ||
import Pino from 'pino'; | ||
|
||
export const pino = Pino({ | ||
level: process.env.LOG_LEVEL ? process.env.LOG_LEVEL : 'info', | ||
}); |
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