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

How to set cors globally? #18

Open
svnty opened this issue Jan 24, 2024 · 1 comment
Open

How to set cors globally? #18

svnty opened this issue Jan 24, 2024 · 1 comment

Comments

@svnty
Copy link
Contributor

svnty commented Jan 24, 2024

Hello,

How can I set cors globally? In express it would be

app.use(cors());

I have nbit working as such

        return Response.json({ hello: 'world' }, {
          headers: {
            "Access-Control-Allow-Methods": "GET, HEAD, POST, OPTIONS",
            "Access-Control-Allow-Headers": "Content-Type, Accept",
            "Access-Control-Allow-Origin": "https://medicamina.us"
          });

but I don't want to copy paste this boilerplate headers object everywhere, can I set it once and forget about it like app.use(cors())?

@sstur
Copy link
Owner

sstur commented Jan 26, 2024

Currently this isn't possible, but I've implemented a proof of concept in #19, if you have any thoughts.

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

No branches or pull requests

2 participants