Nunjucks Powers Mozilla

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

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

    Keywords

    none

    Install

    npm i middy-koa-wrapper

    DownloadsWeekly Downloads

    188

    Version

    2.0.1

    License

    MIT

    Unpacked Size

    23 kB

    Total Files

    7

    Last publish

    Collaborators

    • bbeesley