oRPC CORS Plugin
CORS Plugin for oRPC.
SKILL.mdskills/orpc-cors/SKILL.md
GitHubCORS Plugin
CORSPlugin allows you to configure CORS for your API.
Basic
import { CORSPlugin } from '@orpc/server/plugins'
const handler = new RPCHandler(router, {
plugins: [
new CORSPlugin({
origin: (origin, options) => origin,
allowMethods: ['GET', 'HEAD', 'PUT', 'POST', 'DELETE', 'PATCH'],
// ...
}),
],
})
The
handlercan be any supported oRPC handler —RPCHandler,OpenAPIHandler, or a custom handler.