MCPcopy Create free account
hub / github.com/anomalyco/opencode / cors

Function cors

packages/opencode/src/server/routes/instance/httpapi/server.ts:121–128  ·  view source on GitHub ↗
(corsOptions?: CorsOptions)

Source from the content-addressed store, hash-verified

119export const context = Context.makeUnsafe<unknown>(new Map())
120
121const cors = (corsOptions?: CorsOptions) =>
122 HttpRouter.middleware(
123 HttpMiddleware.cors({
124 allowedOrigins: (origin) => isAllowedCorsOrigin(origin, corsOptions),
125 maxAge: 86_400,
126 }),
127 { global: true },
128 )
129
130// Route tree:
131// - rootApiRoutes: typed /global/* and control routes; auth is declared by RootHttpApi.

Callers 2

createRoutesFunction · 0.85
[...path].tsFile · 0.85

Calls 1

isAllowedCorsOriginFunction · 0.90

Tested by

no test coverage detected