Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cors support for api resource #205

Open
davemooreuws opened this issue Oct 16, 2023 · 1 comment
Open

cors support for api resource #205

davemooreuws opened this issue Oct 16, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@davemooreuws
Copy link
Member

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.

@davemooreuws davemooreuws added the enhancement New feature or request label Oct 16, 2023
@davemooreuws davemooreuws self-assigned this Oct 16, 2023
@davemooreuws
Copy link
Member Author

This will need to be redone for v1 of Nitric. If anyone is really needing this, thumbs up this post or jump onto our discord.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant