import type { Article } from '#shared/types/blog' type RawArticle = Omit & { content: string | null } export default defineEventHandler(async (event): Promise
=> { const slug = getRouterParam(event, 'slug') if (!slug) { throw createError({ statusCode: 400, statusMessage: 'Missing article slug' }) } const response = await strapiFetch>( `/api/articles?${ARTICLE_DETAIL_QUERY}&filters[slug][$eq]=${encodeURIComponent(slug)}&pagination[pageSize]=1` ) const article = response.data[0] if (!article) { throw createError({ statusCode: 404, statusMessage: 'Article not found' }) } const { content, ...rest } = article return { ...rest, html: renderMarkdown(content), summary: summarise(content) } })