lunasqu.ee-nuxt/server/api/blog/[slug].ts
2022-10-16 12:37:13 +03:00

11 lines
274 B
TypeScript

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