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)
        }
    }
    

    Install

    npm i tenant-app-shared-functions

    DownloadsWeekly Downloads

    2

    Version

    6.3.0

    License

    ISC

    Unpacked Size

    364 kB

    Total Files

    29

    Last publish

    Collaborators

    • peterugah
    • devadeboye
    • dreaminblue