-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
If the intent is to really turn this into a backing service, should probably add the following.
- Add CORS support (cross origin)
- Size limit for body parser (5kb should be way more than enough), will prevent some flooding/injection attacks
- Add error handler to return JSON, good for all API interfaces to return errors in the common format used by the API itself. Errors should return an object, with a single error property, with at least a code (corresponding to http status code, and message, containing error text, and optionally other error properties).
{ // single object response, with single property of "error"
error: {
code: 400 //invalid input, or 5xx for other errors
,message: error.message // original or custom error message
,...error // other properties from error, message is part of inheritance and doesn't serialize
}
}
Possible value-adds:
Metadata
Metadata
Assignees
Labels
No labels