-
Notifications
You must be signed in to change notification settings - Fork 369
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
15 changed files
with
1,313 additions
and
1,086 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
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 |
---|---|---|
@@ -1,38 +1,12 @@ | ||
import { appRouter, createTRPCContext } from '@master-bot/api'; | ||
import { fetchRequestHandler } from '@trpc/server/adapters/fetch'; | ||
import { auth } from '@master-bot/auth'; | ||
|
||
export const runtime = 'nodejs'; | ||
|
||
/** | ||
* Configure basic CORS headers | ||
* You should extend this to match your needs | ||
*/ | ||
function setCorsHeaders(res: Response) { | ||
res.headers.set('Access-Control-Allow-Origin', '*'); | ||
res.headers.set('Access-Control-Request-Method', '*'); | ||
res.headers.set('Access-Control-Allow-Methods', 'OPTIONS, GET, POST'); | ||
res.headers.set('Access-Control-Allow-Headers', '*'); | ||
} | ||
|
||
export function OPTIONS() { | ||
const response = new Response(null, { | ||
status: 204 | ||
}); | ||
setCorsHeaders(response); | ||
return response; | ||
} | ||
import { appRouter, createTRPCContext } from '@master-bot/api'; | ||
|
||
const handler = auth(async req => { | ||
const response = await fetchRequestHandler({ | ||
endpoint: '/api/trpc', | ||
router: appRouter, | ||
const handler = (req: Request) => | ||
fetchRequestHandler({ | ||
req, | ||
createContext: () => createTRPCContext({ auth: req.auth, req }) | ||
router: appRouter, | ||
endpoint: '/api/trpc', | ||
createContext: createTRPCContext | ||
}); | ||
|
||
setCorsHeaders(response); | ||
return response; | ||
}); | ||
|
||
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
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 |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
"name": "master-bot-turbo", | ||
"private": true, | ||
"engines": { | ||
"node": ">=v18.16.1" | ||
"node": ">=v20.0.0" | ||
}, | ||
"packageManager": "[email protected]", | ||
"scripts": { | ||
|
@@ -22,11 +22,11 @@ | |
"docker-compose": "docker compose --env-file docker.env up -d --build" | ||
}, | ||
"dependencies": { | ||
"@ianvs/prettier-plugin-sort-imports": "^4.1.0", | ||
"@ianvs/prettier-plugin-sort-imports": "^4.1.1", | ||
"@manypkg/cli": "^0.21.0", | ||
"prettier": "^3.0.1", | ||
"prettier-plugin-tailwindcss": "^0.4.1", | ||
"turbo": "^1.10.12", | ||
"typescript": "^5.1.6" | ||
"prettier": "^3.1.0", | ||
"prettier-plugin-tailwindcss": "^0.5.7", | ||
"turbo": "^1.10.16", | ||
"typescript": "^5.3.2" | ||
} | ||
} |
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.