api.js 421 Bytes
'use strict';

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

  // 给proxy设置token 
  router.get(/^\/api\/[\w/]+/, 'proxy.get');
  router.get(/^\/auth_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');
}