Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@flexible-agency/serverless-middleware

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@flexible-agency/serverless-middleware

Default serverless middleware for some of our projects.

  • 1.5.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
76
decreased by-3.8%
Maintainers
1
Weekly downloads
 
Created
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

Package last updated on 22 Apr 2023

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc