Skip to content

如何在protected_router.js里添加私有的路由 #8853

Answered by syrinka
shawn8888 asked this question in Q&A
Discussion options

You must be logged in to vote
// 修改 protected_router.js
// 这里我把身份认证部分删掉了
const Router = require('@koa/router');
const router = new Router();

// 实际路由为 /protected/path/to/site
router.get('/path/to/site', require('./private/site'));

module.exports = router;

写法参照 https://github.com/DIYgod/RSSHub/blob/master/lib/router.js 就好

部署时加上两行挂载命令

volumes:
- {修改后的 protected_router.js}:/app/lib/protected_router.js
- {私有路由放置文件夹}:/app/lib/private

Replies: 4 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@appleftg
Comment options

Answer selected by TonyRL
Comment options

You must be logged in to vote
1 reply
@gkeyes
Comment options

Comment options

You must be logged in to vote
1 reply
@libukai
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
6 participants