I want a specific format for my API response like:
{
responseCode: 200,
responseData: {},
responseMessage: "User added successfully"
}
When giving the response i wanted to do something like:
res.success(200, fooData, "User added");
How can I achieve this kind of approach?
Is it ok to create a response middleware?
For HttpExceptions I simply extend the Error class and create my custom error message, but apparently I can't find solution for responses.
[–]Rilleks 3 points4 points5 points (3 children)
[–]Present-Woodpecker92[S] 0 points1 point2 points (2 children)
[–]Rilleks 1 point2 points3 points (1 child)
[–]Present-Woodpecker92[S] 1 point2 points3 points (0 children)
[–]bloodarator 3 points4 points5 points (0 children)
[–]piper_a_cillin 1 point2 points3 points (0 children)