@littlezigy/responsehelper
v1.1.1
Published
A wrapper for express res object.
Downloads
1
Readme
Response Helper by littlezigy
A simple wrapper for express' response object.
Getting Started
npm i @littlezigy/responsehelper app.use('responsehelper');
Here's how it works
Sending a string
res.success('It worked!');
{
success: "It worked!"
}
res.gerror("Sorry. Try again");
{
error: "Sorry. Try again"
}
Sending an object
const data = {bleep: 'bloop', bop, 'hop'};
res.success(data);
{
success: "Operation Successful",
data: {
"bleep": "bloop",
"bop": "hop"
}
}
res.gerror(data);
{
error: "Error",
data: {
"bleep": "bloop",
"bop": "hop"
}
}
Have fun!