lambda-responses

Simple npm package for helping with lambda responses

Usage no npm install needed!

<script type="module">
  import lambdaResponses from 'https://cdn.skypack.dev/lambda-responses';
</script>

README

Lambda Responses

Build Status

Simple library to help with lambda responses.

Success

Call the success function to return the 200 response.

const { success } = require('../utils/responses');

return success({
  status: 'success',
  data: {
    message: 'This is a sample message',
  },
});

Failure

Call the failure function to return the 500 response.

const { failure } = require('../utils/responses');

return failure({
  status: 'failure',
  data: {
    message: 'This is a sample message',
  },
});

Not Found

Call the notFound function to return the 500 response.

const { notFound } = require('../utils/responses');

return notFound({
  status: 'notFound',
  data: {
    message: 'This is a sample message',
  },
});