@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!

Dependencies (0)

    Dev Dependencies (2)

    Package Sidebar

    Install

    npm i @littlezigy/responsehelper

    Weekly Downloads

    0

    Version

    1.1.1

    License

    ISC

    Unpacked Size

    3.39 kB

    Total Files

    4

    Last publish

    Collaborators

    • littlezigy