Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

koa2-converter-middleware

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa2-converter-middleware

一个将express中间件转换为koa2中间件的小工具,可用于webpack-dev-middleware,对应的express版本为4.17.X,koa的版本号为2.x

latest
Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
3
-40%
Maintainers
1
Weekly downloads
 
Created
Source

koa2-converter-middleware

一个将express中间件转换为koa2中间件的小工具,可用于webpack-dev-middleware,对应的express版本为4.17.X,koa的版本号为2.x

Getting Started

First thing's first, install the module:

npm install koa2-converter-middleware --save-dev

Note: We do not recommend installing this module globally.

Usage

const app = require('koa')();
const converter = require("koa2-converter-middleware");
//此处为引用的express中间件,测试的webpack-dev-middleware版本为4.1.0
const middleware = require('webpack-dev-middleware');
const compiler = webpack({
  // webpack options
});
app.use(converter(middleware(compiler, {
    // webpack-dev-middleware options
})));

app.listen(3000, () => console.log('Example app listening on port 3000!'));

Support

在开发中遇到中间件的问题,在网上找的npm包过于古老或无人维护,所以自己发了个包。这里只是将express中间件包了一层,使其可以用在koa2上面,目前只在webpack-dev-middleware上试过。有问题请提issue。

Keywords

koa2

FAQs

Package last updated on 08 Apr 2021

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