lunasqu.ee-nuxt/server/api/blog/[slug].ts

11 lines
274 B
TypeScript
Raw Permalink Normal View History

2022-10-16 09:37:13 +00:00
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) {}
});