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 ./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'); })();