(request: Request)
| 353 | }; |
| 354 | |
| 355 | const handleRequest = async (request: Request): Promise<Response> => { |
| 356 | const url = new URL(request.url); |
| 357 | if (url.pathname === "/health") return json({ ok: true }); |
| 358 | if ( |
| 359 | url.pathname === "/.well-known/oauth-authorization-server" || |
| 360 | url.pathname === "/.well-known/openid-configuration" |
| 361 | ) { |
| 362 | return oauthMetadata(request); |
| 363 | } |
| 364 | if (url.pathname.startsWith("/.well-known/oauth-protected-resource")) { |
| 365 | return protectedResourceMetadata(request); |
| 366 | } |
| 367 | if (url.pathname === "/register" && request.method === "POST") return handleRegister(request); |
| 368 | if (url.pathname === "/authorize" && request.method === "GET") return handleAuthorize(request); |
| 369 | if (url.pathname === "/login") return handleLogin(request); |
| 370 | if (url.pathname === "/token" && request.method === "POST") return handleToken(request); |
| 371 | if (url.pathname.startsWith("/openapi/")) return handleOpenApi(request); |
| 372 | if (url.pathname === "/graphql") return handleGraphql(request); |
| 373 | if (url.pathname === "/mcp") return handleMcp(request); |
| 374 | return json({ error: "not_found" }, { status: 404 }); |
| 375 | }; |
| 376 | |
| 377 | export default { |
| 378 | fetch: handleRequest, |
nothing calls this directly
no test coverage detected