UNPKG

@nuxthub/core

Version:

Build full-stack Nuxt applications on Cloudflare, with zero configuration.

15 lines (14 loc) 473 B
import { eventHandler, createError } from "h3"; import { requireNuxtHubAuthorization } from "../../../../utils/auth.js"; import { useRuntimeConfig } from "#imports"; export default eventHandler(async (event) => { await requireNuxtHubAuthorization(event); const hub = useRuntimeConfig().hub; if (!hub.openapi) { throw createError({ statusCode: 422, message: "OpenAPI not configured" }); } return $fetch(hub.openAPIRoute).catch(() => ({})); });