import AppShellDemo from "./temp/appshell.html"; import { AppShell } from "./src/frontend/AppShell"; async function blogPosts() { const glob = new Bun.Glob("**/*.md"); const blogPosts: Record = {} for await (const file of glob.scan("./content")) { const post = await import(`./content/${file}`, { with: { type: "html" } }); const route = `/${file.replace(/\.md$/, "")}`; blogPosts[route] = post.default; } Object.keys(blogPosts).map((route) => { console.info(route); }); return blogPosts; } Bun.serve({ development: { hmr: true, console: true }, routes: { "/": AppShellDemo, ... await blogPosts(), "/content/*": { async GET(req: Request) { // Having trouble using Bun Bundler alongside a custom route handler to send // different content depending on the request headers, will use /content subpath instead // (unless I can figure it out) return new Response("This will send the blog post content without the app shell") } } } })