Laconia

Laconia

  • Getting Started
  • API
  • Help

›Laconia vs. Other

Introduction

  • Getting Started
  • Motivation
  • Core Concepts
  • Philosophy
  • Examples
  • FAQ
  • Support Me

Laconia vs. Other

  • Claudia
  • Express, Koa, Hapi, etc.
  • Middy
  • Serverless, SAM, Apex, etc.

Guides

  • Injecting Dependencies
  • Unit Testing
  • Adapting Events
  • Creating API Endpoints
  • Retrieving Secrets
  • Retrieving Config
  • Warming Up
  • Invoking Other Lambdas
  • Long Running Tasks
  • Creating Middleware

API Reference

  • API Reference: Intro
  • core
  • event
  • adapter
  • adapter-api
  • invoker
  • config
  • batch
  • middleware-lambda-warmer
  • middleware-serverless-plugin-warmup
Edit

Laconia vs. Middy

Middy is a middleware engine for AWS Lambda. Middy has a lot of similarity with Laconia as it's trying to tackle a similar problem. Conceptually, Middy is looser in term of how you are creating your Lambda handler as everything are middlewares. Laconia is introducing more structure to your Lambda handler with its core concepts.

In Laconia, middleware is a concept that is recommended to be used on your Handler i.e. before the adapter. Middlewares in Laconia should only deal with Cloud provider specific concerns that are not covered by the Adapters ( doNotWaitForEmptyEventLoop is one good example). The middleware approach that has been taken by Laconia is also different, the middlewares are just plain higher order decorator functions.

Although Middy can be used together with Laconia in one Lambda (see examples), please take good care of the separation of concerns Laconia introduces as specified above. There are only a handful of Middy's built-in middlewares that fit into Laconia concept of middlewares. To help you gain a better understanding of that, see the table below:

Middy Built-in MiddlewareLaconia Recommendation
cacheCan use
corsUse adapter-api: Set responseAdditionalHeaders
doNotWaitForEmptyEventLoopCan use
httpContentNegotiationUse adapter-api: Not built-in yet
httpErrorHandlerUse adapter-api: Set errorMappings
httpEventNormalizerUse adapter-api: Not needed as users don't deal with events directly
httpHeaderNormalizerUse adapter-api: Built-in
httpPartialResponseUse adapter-api: Not built-in yet
jsonBodyParserUse adapter-api: Built-in
s3KeyNormalizerUse config: Built-in
secretsManagerUse config: Not built-in yet
ssmUse config: Built-in
validatorCan use
urlEncodeBodyParserUse adapter-api: Built-in
warmupCan use (also Built-in via middleware-serverless-plugin-warmup)
← Express, Koa, Hapi, etc.Serverless, SAM, Apex, etc. →
Laconia
Docs
Getting StartedCore ConceptsAPI Reference
Community
Stack OverflowChat
More
TwitterGitHubStar
Copyright © 2022 Wisen Tanasa
Logo designed by Suzie Nam