Options
Options are only available if you use without Api and Router.
Option
Type
Description
cors
boolean
Static value that enable the headers cors in all responses.
credentials
boolean
Static value that enable the headers credentials in all responses.
request
object
Parameter optional in the initialization the class.
Example:
exports.handler = (event, context) => {
const request = new ApiRequest(event, context);
...
ApiResponse.cors = true;
ApiResponse.credentials = true;
const response = new ApiResponse(request);
response.status(200);
response.header("my-custom-header", "my-header");
return response
.send({
id: 1,
name: "admin",
status: true
});
}
Last updated
Was this helpful?