-
Notifications
You must be signed in to change notification settings - Fork 330
Description
To be able to implement an API with tide, we need to be able to answer OPTION requests with appropriate CORS headers.
Feature Request
Detailed Description
Investigation is needed, but we would probably use the Context API.
We can either integrate handling of CORS in the core of tide, or implement it as a tide-cors
crate.
Option 1, integration: CORS is essential to every framework. So integrating it would make sense
Option 2, external crate: In a professional environment, CORS is for example handled via Docker or NGINX, and not directly from the service itself. Therefore it is technically not needed on application level.
Context
Having an option to pull the handling of CORS into your application would make it easier to test it without integrating it in your general systems architecture.
Smaller services would also probably handle CORS directly via the service itself, therefore the user of tide would have a complete environment.
Possible Implementation
Thanks to the input from @prasannavl, we can look at the actix-cors
implementation.
Another example implementation (part of it) coud like this this.