middy-koa-wrapper
TypeScript icon, indicating that this package has built-in type declarations

2.1.0 • Public • Published

middy-koa-wrapper

Description

A wrapper to convert middy middleware for use with koa.

Usage

Vanilla JS

const eventNormaliser = require('@perform/sls-middleware-http-event-normalizer'); // the middy middleware
const { default: wrap } = require('middy-koa-wrapper');

app.use(wrap(eventNormaliser()));

ES6

import cors from '@middy/http-cors'; // the middy middleware
import wrap from 'middy-koa-wrapper';

app.use(wrap(eventNormaliser()));

API

Table of Contents

wrap

src/index.ts:139-172

Main wrapper fn to convert middy middleware to koa middleware

Parameters

  • middyware Object The middy middleware
    • middyware.before Function? The middy before hook
    • middyware.after Function? The middy after hook
    • middyware.onError Function? The middy onError hook
  • name string (optional, default 'middyware')

Returns Object async koa middleware object

Dependents (0)

Package Sidebar

Install

npm i middy-koa-wrapper

Weekly Downloads

1

Version

2.1.0

License

MIT

Unpacked Size

43.7 kB

Total Files

11

Last publish

Collaborators

  • bbeesley