You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
It's common to configure CORS headers in API endpoints. Laconia at the moment does not provide anything out of the box to configure CORS.
Describe the solution you'd like
CORS capability must be provided built-in and configured through environment variables. The reason it must be configured through environment variables is because CORS must also be configured in AWS API Gateway.
For example if serverless framework is used, it may look like:
constadapterApi=require("@laconia/adapter-api");// Automatically reads LACONIA_ADAPTER_CORS_ORIGIN and respond with CORS headersconstapigateway=adapterApi.apigateway()exports.handler=laconia(apigateway(app)).register(instances);
The above code will return a HTTP api gateway response with this header:
@laconiajs/contributors Sorry I should have started this issue as a discussion. But it would be great if you can review the above public contract / API.
ceilfors
changed the title
Make cors middleware built-in
Make cors feature built-in
Jul 3, 2019
Is your feature request related to a problem? Please describe.
It's common to configure CORS headers in API endpoints. Laconia at the moment does not provide anything out of the box to configure CORS.
Describe the solution you'd like
CORS capability must be provided built-in and configured through environment variables. The reason it must be configured through environment variables is because CORS must also be configured in AWS API Gateway.
For example if serverless framework is used, it may look like:
The function code:
The above code will return a HTTP api gateway response with this header:
ORIGIN is used instead of ORIGINS in the environment variable, because I don't think we HTTP protocol allow multiple origins.
Acceptance Criteria
The text was updated successfully, but these errors were encountered: