feat: add new site

This commit is contained in:
Alexander Daichendt 2022-07-26 00:25:51 +02:00
parent 53738961bb
commit 532a32db68
27 changed files with 1198 additions and 1328 deletions

View file

@ -0,0 +1,19 @@
import type { BlogPostFrontmatter, BlogPostMeta } from '../../types';
export async function GET() {
const modules = import.meta.glob('./*.svx');
const posts: BlogPostMeta[] = [];
const resolved = (await Promise.all(Object.values(modules).map((f) => f()))) as {
metadata: BlogPostFrontmatter;
}[];
resolved.forEach(({ metadata }, index) => {
const path = Object.keys(modules)[index].replace('.svx', '');
posts.push({ ...metadata, href: `blog/${path}` });
});
return {
body: { posts }
};
}