@pinpt/fn

A tiny micro framework for the Serverless framework for building fast λ functions

Usage no npm install needed!

<script type="module">
  import pinptFn from 'https://cdn.skypack.dev/@pinpt/fn';
</script>

README

pinpt-logo

A tiny micro framework for the Serverless framework for building fast λ functions

forthebadge

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.