Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 96cd898

Browse files
author
wmui
committed
feat: auth
1 parent 834c117 commit 96cd898

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

app/router.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,33 @@ module.exports = app => {
1919
// 获取文章
2020
router.get('/api/post', controller.post.find);
2121
// 添加文章
22-
router.post('/api/post', controller.post.save);
22+
router.post('/api/post', auth(), controller.post.save);
2323
// 修改文章
2424
// router.put('/api/post', controller.post.save);
2525
// 删除文章
26-
router.delete('/api/post/:id', controller.post.remove);
26+
router.delete('/api/post/:id', auth(), controller.post.remove);
2727
// 系统安装
2828
router.get('/install', controller.user.install);
2929
// 登录模板
3030
router.get('/login', controller.user.loginTmp);
3131
// 登录验证码
3232
router.get('/api/captcha', controller.user.captcha);
3333
// 获取管理员信息
34-
router.get('/api/user', controller.user.find);
34+
router.get('/api/user', auth(), controller.user.find);
3535
// 修改管理员信息
36-
router.put('/api/user', controller.user.save);
36+
router.put('/api/user', auth(), controller.user.save);
3737
// 管理员登录
3838
router.post('/api/login', controller.user.login);
3939
// 初始化管理员
4040
router.post('/api/user', controller.user.init);
4141
// 设置
42-
router.get('/setting', controller.option.setting);
42+
router.get('/setting', auth(true), controller.option.setting);
4343
// 修改或新增seo
44-
router.post('/api/seo', controller.option.saveSeo);
45-
router.get('/api/seo', controller.option.findSeo);
44+
router.post('/api/seo', auth(), controller.option.saveSeo);
45+
router.get('/api/seo', auth(), controller.option.findSeo);
4646

4747
// 资源上传
48-
router.post('/api/upload', controller.post.upload);
48+
router.post('/api/upload', auth(), controller.post.upload);
4949
// version
5050
router.get('/api/version', controller.option.version);
5151
// 其他

0 commit comments

Comments
 (0)