UNPKG

315 BJavaScriptView Raw
1const join = require('../src/join');
2
3module.exports = (path, ...middle) => async ctx => {
4 const full = ctx.req.subdomains.reverse().join('.');
5 if ((typeof path === 'string' && path === full) ||
6 (path instanceof RegExp && path.test(full))) {
7 await join(middle)(ctx);
8 ctx.req.solved = true;
9 }
10};