CORS
Configure CORS for your application.
cheetah has built-in support for CORS. You can configure it according to the specification of the Access-Control-Allow-Origin
header.
Global
import cheetah from 'https://deno.land/x/cheetah/mod.ts'
const app = new cheetah({
cors: '*'
})
Per Collection
import cheetah, { Collection } from 'https://deno.land/x/cheetah/mod.ts'
const collection = new Collection({
cors: 'example.com'
})
Per Route
import cheetah from 'https://deno.land/x/cheetah/mod.ts'
const app = new cheetah()
app.get('/foo', {
cors: 'example.com'
}, () => {
// handle request
})