This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

tenant-app-shared-functions

6.3.0 • Public • Published

tenant-app-shared-functions

This package content all functions that is used across services in tenant app

Installation

To install, run the code below:

npm install tenant-app-shared-functions

Functions

  • okHttpResponse:
    This is use to send ok http response to the client after an operation.
    syntax
    okHttpResponse(res, response, message='success')
    note: res is the express response object while response is the response you want to send to the client.

  • errorResponse:
    This is use to send Not_found http response to the client after an operation.
    syntax
    errorResponse(res, message)
    note: res is the express response object while message is the message you want to send to the client about the error.

Example 1:

(req, res) => {
    try {
        doSomething();
        okHttpResponse(res, response);
    }
    catch (e) {
        errorResponse(res, e.message)
    }
}

Example 2:

(req, res) => {
    try {
        doSomething();
        okHttpResponse(
            res,
            response,
            'operation was successful'
        );
    }
    catch (e) {
        errorResponse(res, e.message)
    }
}

Readme

Keywords

Package Sidebar

Install

npm i tenant-app-shared-functions

Weekly Downloads

1

Version

6.3.0

License

ISC

Unpacked Size

364 kB

Total Files

29

Last publish

Collaborators

  • devadeboye
  • dreaminblue
  • peterugah