2023-11-30 14:15:19 +00:00

11 lines
315 B
JavaScript

const join = require('../src/join');
module.exports = (path, ...middle) => async ctx => {
const full = ctx.req.subdomains.reverse().join('.');
if ((typeof path === 'string' && path === full) ||
(path instanceof RegExp && path.test(full))) {
await join(middle)(ctx);
ctx.req.solved = true;
}
};