1.0.7 • Published 4 years ago

@dotcook/lambda-api v1.0.7

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

install

npm i @dotcook/lambda-api

Simple Example

const Joi = require('@hapi/joi');
const { Api, Validate } = require('@dotcook/lambda-api');

module.exports = {
    hello: Api(async (event, context) => {
        return {
            hi: '123',
        };
    }),
    apiWithCustomStatusCode: Api(async (event, context) => {
        return {
            statusCode: 201,
            result: {},
        }
    }),
    apiWithValidation: Api(Validate({
        path: {
            ids: Joi.string().required(),
        },
        query: {
            page: Joi.number().optional(),
        },
        body: {
            operation: Joi.any(),
        },
    }), async (event) => {
        return {
            body: event.body,
            query: event.queryStringParameters,
            path: event.pathParameters,
        }
    }),
};
1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago