lunasqu.ee-nuxt/server/api/blog/[slug].ts
2023-09-22 18:01:40 +03:00

10 lines
252 B
TypeScript

import { getBlogPost } from '~~/lib/blog/read-posts';
export default defineEventHandler(async (event) => {
const slug = getRouterParam(event, 'slug');
try {
const post = await getBlogPost(slug as string);
return post;
} catch (e) {}
});