-
Notifications
You must be signed in to change notification settings - Fork 36
/
api_router_v1.js
34 lines (26 loc) · 1.28 KB
/
api_router_v1.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
var express = require('express');
var topicController = require('./api/v1/topic');
var userController = require('./api/v1/user');
var toolsController = require('./api/v1/tools');
var replyController = require('./api/v1/reply');
var messageController = require('./api/v1/message');
var middleware = require('./api/v1/middleware');
var router = express.Router();
// 主题
router.get('/topics', topicController.index);
router.get('/topic/:id', topicController.show);
router.post('/topics', middleware.auth, topicController.create);
router.post('/topic/collect', middleware.auth, topicController.collect); // 关注某话题
router.post('/topic/de_collect', middleware.auth, topicController.de_collect); // 取消关注某话题
// 用户
router.get('/user/:loginname', userController.show);
// accessToken 测试
router.post('/accesstoken', middleware.auth, toolsController.accesstoken);
// 评论
router.post('/topic/:topic_id/replies', middleware.auth, replyController.create);
router.post('/reply/:reply_id/ups', middleware.auth, replyController.ups);
// 通知
router.get('/messages', middleware.auth, messageController.index);
router.get('/message/count', middleware.auth, messageController.count);
router.post('/message/mark_all', middleware.auth, messageController.markAll);
module.exports = router;