feat: get home feed in server side

This commit is contained in:
DIYgod
2023-07-13 22:02:21 +01:00
parent a2ba8d6a9a
commit b0a92e0dba
5 changed files with 43 additions and 21 deletions
+21
View File
@@ -0,0 +1,21 @@
import { NextServerResponse, getQuery } from "~/lib/server-helper"
import { getFeed } from "~/models/home.model"
export async function GET(req: Request) {
const query = getQuery(req)
const result = await getFeed({
type: query.type,
cursor: query.cursor,
limit: +query.limit || undefined,
characterId: +query.characterId || undefined,
daysInterval: +query.daysInterval || undefined,
searchKeyword: query.searchKeyword,
searchType: query.searchType,
tag: query.tag,
useHTML: false,
topic: query.topic,
})
const res = new NextServerResponse()
return res.status(200).json(result)
}