admin.js 1.5 KB

1234567891011121314151617181920212223
  1. 'use strict';
  2. // 路由配置
  3. const path = require('path');
  4. const regPath = path.resolve('app', 'public', 'routerRegister');
  5. const routerRegister = require(regPath);
  6. const rkey = 'admin';
  7. const ckey = 'user.admin';
  8. const keyZh = '管理员';
  9. const routes = [
  10. { method: 'post', path: `${rkey}/toMakeKey`, controller: `${ckey}.toMakeKey`, name: `${ckey}toMakeKey`, zh: `${keyZh}-生成管理员操作key` },
  11. { method: 'post', path: `${rkey}/emailResetPwd`, controller: `${ckey}.emailResetPwd`, name: `${ckey}emailResetPwd`, zh: `${keyZh}-随机重置密码并发送邮件` },
  12. { method: 'post', path: `${rkey}/resetPwd/:id`, controller: `${ckey}.resetPwd`, name: `${ckey}ResetPwd`, zh: `修改密码${keyZh}` },
  13. { method: 'post', path: `${rkey}/login`, controller: `${ckey}.login`, name: `${ckey}Login`, zh: `${keyZh}登陆` },
  14. { method: 'get', path: `${rkey}`, controller: `${ckey}.index`, name: `${ckey}Query`, zh: `${keyZh}列表查询` },
  15. { method: 'get', path: `${rkey}/:id`, controller: `${ckey}.show`, name: `${ckey}Show`, zh: `${keyZh}查询` },
  16. { method: 'post', path: `${rkey}`, controller: `${ckey}.create`, middleware: ['password'], name: `${ckey}Create`, zh: `创建${keyZh}` },
  17. { method: 'post', path: `${rkey}/:id`, controller: `${ckey}.update`, middleware: ['password'], name: `${ckey}Update`, zh: `修改${keyZh}` },
  18. { method: 'delete', path: `${rkey}/:id`, controller: `${ckey}.destroy`, name: `${ckey}Delete`, zh: `删除${keyZh}` },
  19. ];
  20. module.exports = app => {
  21. routerRegister(app, routes, keyZh, rkey, ckey);
  22. };