-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Is your feature request related to a problem? Please describe.
I can't provide concise error messages on the front-end.
I'm not sure what responses to expect from the API other than success or failure...let's establish a convention
Describe the solution you'd like
- Route
- Failed?
- Stop at 1st encountered error
- return What went wrong in ~3 words? - success?
- return success
- Failed?
Reminder: keep response.data schema consistent
-
Faillure
{ ... data: { success: boolean, error: string } ... } -
Success
{ ... /*where any is the type of the expected response value...*/ data: { success: boolean, data: any } ... }
Targeting routes
- create
- read
- readOne
- update
- confirm
- apply
- unconfirm
- login
- forgotPassword
- resetPassword
- checkIn
- accept
- remindApply
- emailConfirmation
- remindConfirm
- resend
Additional context
-
Consider creating an object of common errors which will help to stay consistent and prevent typos from breaking the server
-
Consider looking into this http-errors
seems pretty helpful