1.3.0 • Published 10 months ago

api-gateway-lambda-router v1.3.0

Weekly downloads
-
License
ISC
Repository
-
Last release
10 months ago

API Gateway Lambda Router

Use this router to manage your routes in AWS Lambda and API Gateway.

Usage

To be able to use this router create a route in API Gateway (API Type: HTTP API) wuth the path /{path+} and method ANY.

Usage example:

import { EventRouter } from 'api-gateway-lambda-router';

const router = new EventRouter({
  defaultHandler: async (requestData, response) => {
    response({
      status: 404,
      data: 'Not found :('
    })
  },
  routes: [
    {
      path: '/hi/:name',
      method: 'GET',
      handler: async (requestData, response) => {
        response({
          data: {
            hello: requestData.pathParameters.name  
          }
        })
      }
    },
  ]
});

export async function handler (event: any) {
  return await router.eventHandler(event);
}
1.3.0

10 months ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago