1.0.0-alpha.1 • Published 4 years ago

@sstack/json v1.0.0-alpha.1

Weekly downloads
8
License
MIT
Repository
github
Last release
4 years ago

@sstack/json

Easy JSON body parsing and request stringifying.

npm i @sstack/json --save

Usage

const { sstack, main } = require('sstack')
const { parse, stringify } = require('@sstack/json')

exports.handler = sstack([
  parse(),
  main(event => {
    console.log(typeof event.body) // 'object'
  }),
  stringify()
])

You may also want to implement this for errors as well, if you plan to return JSON responses when throwing them.

const { sstack, main } = require('sstack')
const { parse, stringify } = require('@sstack/json')
const errors = require('./my-custom-errors.js')

exports.handler = sstack([
  parse(),
  main(event => {
    console.log(typeof event.body) // 'object'
  }),
  stringify()
], [
  errors(),
  stringify()
])

License

MIT License © Eric Bailey

1.0.0-alpha.1

4 years ago

0.1.4

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago