Echo JS 0.11.0

<~>

sbruchmann 3321 days ago. link 1 point
There’s no need to introduce a new variable that is only used once. Just use the conditional (ternary) operator as an argument for `res.status`. For example:

    `res.status(err ? 400 : 201).json(data)`

Apart from this, there’s no _real_ error handling and `express-api-response` doesn’t [help] [1] with this. Sending a `400` status code just because the error argument is not a falsey value is IMHO a suboptimal way of handling errors.

Why not inspecting the given error if it is present? Checking the `err.code` and (if applicable) the `err.message` properties is a good way to start.

[1]: https://github.com/B1naryStudio/express-api-response/blob/0a0f7749bfe69fba7e333348af99f179868329ab/index.js#L11