JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1140
  • Score
    100M100P100Q153181F
  • License Apache-2.0

AWS lambda router

Package Exports

  • aws-lambda-router

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (aws-lambda-router) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Build Status npm version dependencies

aws-lambda-router

A small library providing routing for AWS ApiGateway any method

Install

$ npm install aws-lambda-router

Usage

const httpRouteHandler = require('aws-lambda-router');

exports.handler = httpRouteHandler.handler({
    cors: true,
    routes: [
        {
            path: '/graphql',
            method: 'POST',
            action: request=>doAnything(request.body)
        },
        {
            path: '/article/{id}',
            method: 'GET',
            action: request=>getArticleInfo(request.body)
        },
        {
            path: '/:sourcepath',
            method: 'DELETE',
            action: request=>deleteSourcepath(request.paths.sourcepath)
        }
    ],
    debug: true,
    errorMapping: {
        'NotFound': 404,
        'RequestError': 500
    }
});

Publish a new version to npmjs.org

local developement

The best is to work with npm link

See here: http://vansande.org/2015/03/20/npm-link/

Release History

  • 0.1.0 make it work now
  • 0.0.1 initial release