api.js 371 Bytes
'use strict';

module.exports = app => {
  const { router, controller } = app;
  const { proxy } = controller;

  // 给proxy设置token 
  router.get(/^\/api\/[\w/]+/, 'proxy.get');
  router.post(/^\/api\/[\w/]+/, 'proxy.post');
  router.put(/^\/api\/[\w/]+/, 'proxy.put');
  router.head(/^\/api\/[\w/]+/, 'proxy.head');
  router.delete(/^\/api\/[\w/]+/, 'proxy.del');
}