灏天阁

Node/Koa2[66]:首页加载更多

· Yin灏
// src/routes/api/blog-home.js
const { getHomeBlogList } = require("../../controller/blog-home");
// 加载更多
router.get("/loadMore/:pageIndex", loginCheck, async (ctx, next) => {
  let { pageIndex } = ctx.params;
  pageIndex = parseInt(pageIndex);
  const { id: userId } = ctx.session.userInfo;
  const result = await getHomeBlogList(userId, pageIndex);
  // 渲染模板
  result.data.blogListTpl = getBlogListStr(result.data.blogList);
  ctx.body = result;
});

- Book Lists -