docs: function middlewareStrategy(metadata, dataAdapter, opts) {
      opts.filter = opts.filter || defaultFilter;
      const { filter } = opts;
      return async function magic(ctx, next) {
          const { name, key } = opts.filter.call(null, ctx);
          const obj = metadata[name];
          const { routeSwitch = {} } = obj;
  
          let middleware;
          if (routeSwitch[key] === true) {
              const { pres, posts } = getHooks(obj, key);
              const route = routes[key];
              middleware = route.call(null, name, dataAdapter, opts, pres, posts);
          }
  
          try {
              if (typeof middleware === 'function') {
                  await middleware.call(null, ctx, next);
              } else {
                  await next();
              }
          } catch (err) {
              throw err;
          }
      }
  }