iconRouter.js 661 B

12345678910111213141516171819202122232425262728293031323334
  1. let Router = require('koa-router');
  2. let auth = require('../middleware/auth');
  3. let IconController = require('../controller/iconController');
  4. let iconControllerIns = new IconController();
  5. let router = new Router({
  6. prefix: '/api/icon'
  7. });
  8. /**
  9. * 获取图标列表
  10. *
  11. */
  12. router.get('/list/:userId', async (ctx) => {
  13. await iconControllerIns.getIconList(ctx);
  14. });
  15. /**
  16. * delete user icon
  17. *
  18. */
  19. router.post('/delete/:iconId', auth(), async (ctx) => {
  20. await iconControllerIns.deleteIcon(ctx);
  21. });
  22. /**
  23. * 下载图标
  24. *
  25. */
  26. router.get('/download/:iconId', async (ctx) => {
  27. await iconControllerIns.downloadIcon(ctx);
  28. });
  29. module.exports = router;