@pinpt/fn
v0.0.13
Published
A tiny micro framework for the Serverless framework for building fast λ functions
Downloads
17
Readme
Setup
More coming soon....
Examples
Single Lambda
import { Logger, Request, Response, λ } from '@pinpt/fn';
export const handler = λ( async (req: Request, resp: Response) => {
resp.json({data: 'foo'});
});
Paths with simple router
import { LambdaMethod, Logger, Request, Response, λs } from '@pinpt/fn';
export const handler = λs([
{
handler: async (req: Request, resp: Response) => {
resp.json({data: 'foo'});
},
method: LambdaMethod.Get,
path: '/',
},
{
handler: async (req: Request, resp: Response) => {
resp.json({data: req.params.bar});
},
method: LambdaMethod.Post,
path: '/use/:bar',
}
]);
License
All of this code is Copyright © 2018 by PinPT, Inc. and licensed under the MIT License. Pull requests welcome.