Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

@littlezigy/responsehelper

1.1.1 • Public • Published

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!

Install

npm i @littlezigy/responsehelper

DownloadsWeekly Downloads

0

Version

1.1.1

License

ISC

Unpacked Size

3.39 kB

Total Files

4

Last publish

Collaborators

  • avatar