DailyHotApi/routes/index.js

42 lines
1.1 KiB
JavaScript
Raw Normal View History

2023-03-14 08:04:10 +00:00
const Router = require("koa-router");
const bilibiliRouter = require("./bilibili");
const zhihuRouter = require("./zhihu");
const baiduRouter = require("./baidu");
const weiboRouter = require("./weibo");
const itHomeRouter = require("./ithome");
const krRouter = require("./36kr");
const sspaiRouter = require("./sspai");
const tiebaRouter = require("./tieba");
const toutiaoRouter = require("./toutiao");
const thepaperRouter = require("./thepaper");
2023-03-17 07:21:28 +00:00
const juejinRouter = require("./juejin");
const newsqqRouter = require("./newsqq");
2023-03-14 08:04:10 +00:00
const router = new Router();
// 根目录
router.get("/", async (ctx) => {
await ctx.render("index");
});
router.use(bilibiliRouter.routes());
router.use(zhihuRouter.routes());
router.use(baiduRouter.routes());
router.use(weiboRouter.routes());
router.use(itHomeRouter.routes());
router.use(krRouter.routes());
router.use(sspaiRouter.routes());
router.use(tiebaRouter.routes());
router.use(toutiaoRouter.routes());
router.use(thepaperRouter.routes());
2023-03-17 07:21:28 +00:00
router.use(juejinRouter.routes());
router.use(newsqqRouter.routes());
2023-03-14 08:04:10 +00:00
// 404 路由
router.use(async (ctx) => {
await ctx.render("404");
});
module.exports = router;