-
Notifications
You must be signed in to change notification settings - Fork 1
/
webrouter.js
77 lines (58 loc) · 2.16 KB
/
webrouter.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*!
* nkuticweb-Gorgear
* Copyright(c) 2016 Gorgear
*/
var express = require('express');
var router = express.Router();
var index = require('./routes/index');
var sign = require('./routes/auth');
var blog = require('./routes/blog');
var activity = require('./routes/activity');
var message = require('./routes/message');
var admin = require('./routes/admin');
var user = require('./routes/user');
var wangeditor = require('./routes/wangeidtor');
//middlewares
var auth =require('./middlewares/auth');
//index
router.get('/',index.index);
//sign
//login
router.get('/login',auth.userDirect,sign.getLogin);
router.post('/login',sign.postLogin);
//register
router.get('/register',auth.userDirect,sign.getRegister);
router.post('/register',sign.postRegister);
//logout
router.get('/logout',sign.getLogout);
//blog
router.post('/wangeditor',wangeditor.postEditor);
router.get('/myblog',auth.userRequired,blog.getMyblog);
router.delete('/myblog',auth.userRequired,blog.deleteMyblog);
router.get('/blog',blog.getBlog);
router.post('/blog',blog.postBlog);
//activity
router.get('/activity',activity.getActivity);
//message
router.get('/message',auth.userRequired,message.getMessage);
router.post('/message/readmsg',auth.userRequired,message.readMsg);
router.post('/message/deletemsg',auth.userRequired,message.deleteMsg);
router.post('/message/sendmsg',auth.userRequired,message.sendMsg);
//admin
router.get('/admin',auth.adminRequired,admin.getAdmin);
router.get('/admin/userlist',auth.adminRequired,admin.userList);
router.get('/admin/userdetail/:userid',auth.adminRequired,admin.userDetail);
//collect
router.get('/collect',user.getCollect);
router.get('/collect/:userid',user.getCollect);
router.post('/user',user.postCollect);
//user
router.get('/user',user.getUser);
router.get('/user/:userid',user.getUser);
//settig
//管理员和本人才可以进入这个界面
router.get('/setting/:userid',auth.userRequired,user.getSetting);
router.post('/setting/:userid',auth.userRequired,user.postSetting);
router.get('/setting/password/:userid',auth.userRequired,user.getPasswordSetting);
router.post('/setting/password/:userid',auth.userRequired,user.postPasswordSetting);
module.exports = router;