(request: Request)
| 276 | }; |
| 277 | |
| 278 | const handleOpenApi = (request: Request) => { |
| 279 | const url = new URL(request.url); |
| 280 | if (url.pathname === "/openapi/spec.json") return openApiSpec(request); |
| 281 | if (!isAuthorized(request)) return unauthorized(request); |
| 282 | if (url.pathname === "/openapi/items") { |
| 283 | return json([ |
| 284 | { id: 1, name: "Widget" }, |
| 285 | { id: 2, name: "Gadget" }, |
| 286 | ]); |
| 287 | } |
| 288 | return json({ error: "not_found" }, { status: 404 }); |
| 289 | }; |
| 290 | |
| 291 | const yoga = createYoga({ |
| 292 | schema: createSchema({ |
no test coverage detected