Skip to main content
Module

x/workers_middleware/index.ts>anyCORS

Placeholder for Worker-based middleware solution
Latest
variable anyCORS
import { anyCORS } from "https://deno.land/x/workers_middleware@v0.1.0-pre.36/index.ts";

A CORS middleware that gives clients exactly the permissions they ask for, unless constrained by the definitions in options.

Note that applying this middleware to your routes isn't enough for non-GET requests. Pre-flight/OPTIONS routes need to be added manually:

router.options('/your/path', anyCORS(), () => noContent())
router.post('/your/path', anyCORS(), (req, {}) => ok())

type

(options?: CORSOptions) => unknown