How I can send a custom response and message on status 400+, 500+?
export const (req, res) {
// external api call
const response = await axios.post(...)
//handle response
res.status(200).json(response.data)
// if has an error
res.status(400).json(response.data) }
On front-end, I don't receive the payload data if not status 200
try {
let response = await.post(...)
console.log(response.data)
} catch (error) {
console.log(error) // i cant get the payload passed here if not status 200
}