nbit
nbit copied to clipboard
How to set cors globally?
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())?
Currently this isn't possible, but I've implemented a proof of concept in #19, if you have any thoughts.