Socket
Socket
Sign inDemoInstall

@flexible-agency/serverless-middleware

Package Overview
Dependencies
40
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @flexible-agency/serverless-middleware

Default serverless middleware for some of our projects.


Version published
Weekly downloads
133
increased by58.33%
Maintainers
1
Install size
141 kB
Created
Weekly downloads
 

Readme

Source

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.




Get professional support for this package →
Custom consulting sessions availabe for implementation support and feature development.

Keywords

FAQs

Last updated on 22 Apr 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc