npm

@honestdoor/lambda-utils
TypeScript icon, indicating that this package has built-in type declarations

0.2.4 • Public • Published

@honestdoor/lambda-utils

Collection of helpful utilities around working with lambda functions

Response Builder

The Responder is meant to make api gateway responses easier to write and manage

Example Usage:

import { Responder } from '@honestdoor/lambda-utils'

const res = new Responder({
    // Default response variables
    headers: {
        "Access-Control-Allow-Origin": "locahost:3000"
    },
    statusCode: 400
})

...

const response =  res.status(200).json({ success: true })

...

console.log(response)

Output:

{
  "headers": {
     "Access-Control-Allow-Origin": "locahost:3000"
  },
  "statusCode": 200,
  "body": "{ success: true }"
}

Error Example:

res.status(400).error("Something went terribly wrong!")

Readme

Keywords

none

Package Sidebar

Install

npm i @honestdoor/lambda-utils

Weekly Downloads

0

Version

0.2.4

License

ISC

Unpacked Size

16 kB

Total Files

16

Last publish

Collaborators

  • mac_hd
  • dk-honestdoor