You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
381 B
JavaScript
15 lines
381 B
JavaScript
// Based on: https://github.com/dayAlone/koa-webpack-hot-middleware/blob/master/index.js
|
|
export default function applyExpressMiddleware (fn, req, res) {
|
|
const originalEnd = res.end
|
|
|
|
return new Promise((resolve) => {
|
|
res.end = function () {
|
|
originalEnd.apply(this, arguments)
|
|
resolve(false)
|
|
}
|
|
fn(req, res, function () {
|
|
resolve(true)
|
|
})
|
|
})
|
|
}
|