12345678910111213141516 |
- 'use strict';
- module.exports = app => {
- const { router, controller } = app;
- const profix = '/api/article/';
- const target = 'refute';
- const readMiddleware = app.middleware.read(target);
- const queryMiddleware = app.middleware.thumbs();
- const fetchThumbs = app.middleware.fetchThumbs();
- router.get(target, `${profix}${target}/:id`, readMiddleware, fetchThumbs, controller[target].show);
- router.get(target, `${profix}${target}`, queryMiddleware, controller[target].index);
- router.resources(target, `${profix}${target}`, controller[target]); // index、create、show、destroy
- router.post(target, `${profix}${target}/update/:id`, controller[target].update);
- };
|