-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Could you please check the following code:
/**
* @param {object} options
* @returns {Function}
*/
function koaStylus(options) {
const middleware = stylus.middleware(options);
function compile(req, res) {
return callback => {
middleware(req, res, callback);
};
}
return async function stylusMiddleware(ctx, next) {
compile(ctx.req, ctx.res);
return await next();
};
}This works.. I think. But could someone please explain how it works? What does calling compile do? It just returns a function right? How does that end up executing stylus middleware?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels