Giter Club home page Giter Club logo

koa2-converter-middleware's Introduction

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。

koa2-converter-middleware's People

Contributors

3lweb avatar wangyuanzcm avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.