apiOperation (api/operation.ts)

cloudflare-workers-nextjs-saas-template · src/api/operation.ts · typescript · MIT
auth, Auth / Identity

Helper to define API routes with security, audience, and OpenAPI docs.

// Source: https://github.com/LubomirGeorgiev/cloudflare-workers-nextjs-saas-template | License: MIT | Copyright 2025 Lubomir Georgiev (Любомир Георгиев)
// Provided via justclaw.it.com; keep this notice with the code.
import "server-only";

import type { MiddlewareHandler } from "hono";
import { describeRoute, type DescribeRouteOptions, type ResponsesWithResolver } from "hono-openapi";

import { audienceGuard } from "@/api/middleware/audience";
import { securityForScope } from "@/api/openapi-document";
import { COMMON_ERROR_RESPONSES } from "@/api/openapi";
import { createPolicyMarker } from "@/api/operation-policy";
import { traceApiOperation } from "@/api/operation-trace";
import type { ApiEnv } from "@/api/types";
import { audienceExtension, type ApiOperationAudience } from "@/lib/api/

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key