lunasqu.ee-nuxt/server/api/blog/[slug].ts
2022-10-16 19:17:55 +03:00

10 lines
242 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);
return post;
} catch (e) {}
});