@growsari/response

0.0.3 • Public • Published

Response

Convenience functions. Use in conjunction with errors; attributes retrieved from errors will show up in the response.

Usage

API Gateway responses

const { api } = require('@growsari/response')

async function serverlessHandler(event, ...) {
  try {
    // implementation
    api.success(await someFunction())
  } catch (e) {
    api.error(e)
  }
}

Lambda microservice response

const { microservice } = require('@growsari/response')

async function serverlessHandler(event, ...) {
  try {
    // implementation
    microservice.success(await someFunction())
  } catch (e) {
    microservice.error(e)
  }
}

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @growsari/response

    Weekly Downloads

    127

    Version

    0.0.3

    License

    ISC

    Unpacked Size

    2.01 kB

    Total Files

    3

    Last publish

    Collaborators

    • ddimaano.gs
    • gs.dwight.badua
    • leland.growsari
    • madhugogineni
    • melyo
    • prasad.riktam