mirror of https://github.com/MaxLeiter/Drift
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
746 B
TypeScript
34 lines
746 B
TypeScript
// a nextjs api handerl
|
|
|
|
import config from "@lib/config"
|
|
import markdown from "@lib/render-markdown"
|
|
import { NextApiRequest, NextApiResponse } from "next"
|
|
|
|
export const getWelcomeContent = async () => {
|
|
const introContent = config.welcome_content
|
|
const introTitle = config.welcome_title
|
|
// if (!introContent || !introTitle) {
|
|
// return {}
|
|
// }
|
|
|
|
console.log(introContent)
|
|
|
|
return {
|
|
title: introTitle,
|
|
content: introContent,
|
|
rendered: markdown(introContent)
|
|
}
|
|
}
|
|
|
|
export default async function handler(
|
|
req: NextApiRequest,
|
|
res: NextApiResponse
|
|
) {
|
|
const welcomeContent = await getWelcomeContent()
|
|
if (!welcomeContent) {
|
|
return res.status(500).json({ error: "Missing welcome content" })
|
|
}
|
|
|
|
return res.json(welcomeContent)
|
|
}
|