WIP: Architecture Refactor, add and rename plugins for handling content

This commit is contained in:
2025-12-28 00:17:35 -08:00
parent df449cd3e7
commit 16a441513e
5 changed files with 120 additions and 20 deletions

View File

@@ -0,0 +1,16 @@
import matter from 'gray-matter';
import { loadMetadata } from "./utils";
// When the server starts, import all the blog post metadata into the database
// Executed on startup because it's included in <root> ./bunfig.toml
(async () => {
const glob = new Bun.Glob("**/*.md");
for await (const file of glob.scan("./content")) {
const {data, content } = matter(await Bun.file(`./content/${file}`).text());
const route = `/${file.replace(/\.md$/, "")}`;
loadMetadata(route, data);
}
console.log('Posts have been imported into db');
})();