node-sdk
node-sdk copied to clipboard
cors support for api resource
Feature Request
Suggestion
Add cors middleware handling to the api resource. Enabled by default, with the ability to override headers. It should also auto generate the options handlers per route.
import { api } from '@nitric/sdk';
const mainApi = api('main', {
cors: {
allowOrigins: ['*'],
allowMethods: ['PATCH', 'POST'],
allowHeaders: ['*'],
allowCredentials: true,
maxAge: '300 seconds'
},
});
Value
Reduces the amount of boilerplate code in users apps.