- Notifications
You must be signed in to change notification settings - Fork0
Default serverless middleware for some of our projects.
NotificationsYou must be signed in to change notification settings
includable/serverless-middleware
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A helper for writing APIs using AWS Lambda functions.
- Dependency injection for easy unit testing.
- Pretty JSON error output, with status codes automatically determined based on error message.
- Easy access to query strings and JSON body properties.
- Serverless warmup plugin support.
- OpenTelemetry support and additional span attributes, for use withopentelemetry-lambda.
yarn add @includable/serverless-middleware
import{middleware,auth}from"@includable/serverless-middleware";constdependencies={// dependencies for the dependency injector};exportconstapp=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 herereturn{success:true,text:"Hello, world!",};};exportconsthandler=middleware(app,[auth]).register(dependencies);
Out of the box this middleware setup supports theserverless-plugin-warmupserverless plugin.
Simply install the serverless plugin, no other changes to your code necessary.The middleware will automatically prevent code execution on warmup requests.
If an active OpenTelemetry span is detected, event and response properties will automatically be added.
Get professional support for this package →
Custom consulting sessions availabe for implementation support and feature development.
Custom consulting sessions availabe for implementation support and feature development.
About
Default serverless middleware for some of our projects.
Topics
Resources
Stars
Watchers
Forks
Packages0
No packages published