1.5.1 • Published 1 year ago

@flexible-agency/serverless-middleware v1.5.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Serverless Middleware

Some helpers for writing API endpoints using AWS Lambda and Laconia.


Installation

yarn add @flexible-agency/serverless-middleware

Example usage

import { middleware, auth } from '@flexible-agency/serverless-middleware';

const dependencies = () => ({
	// dependencies for the Laconia dependency injector
});

export const app = async({ query, path, body }, { currentUser, /* dependences */ }) => {
	// if `auth` is included in the second param of `middleware`, currentUser
	// will be an object in the form of `{ id, groups, email, ... }`

	// your business logic goes here

	return {
		success: true,
		text: 'Hello, world!'
	};
}

export const handler = middleware(app, [auth]).register(dependencies);

Options

Warmup support

Out of the box this middleware setup supports the serverless-plugin-warmup serverless plugin.

Simply install the serverless plugin, no other changes to your code necessary. The middleware will automatically prevent code execution on warmup requests.


1.5.1

1 year ago

1.5.0

1 year ago

1.4.5

1 year ago

1.4.4

1 year ago

1.4.3

1 year ago

1.4.2

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.0

2 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.1.2

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago