All files / router sub.js

16.67% Statements 1/6
0% Branches 0/6
0% Functions 0/2
20% Lines 1/5
1 2 3 4 5 6 7 8 91x                
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 ctx.utils.join(middle)(ctx);
    ctx.replied = true;
  }
};