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

10 lines
252 B
TypeScript
Raw Normal View History

2022-10-16 16:17:55 +00:00
import { getBlogPost } from '~~/lib/blog/read-posts';
2022-10-16 09:37:13 +00:00
export default defineEventHandler(async (event) => {
const slug = getRouterParam(event, 'slug');
try {
2023-09-22 15:01:40 +00:00
const post = await getBlogPost(slug as string);
2022-10-16 09:37:13 +00:00
return post;
} catch (e) {}
});