app/routes/blog.$slug[.md].ts
16 lines and 1 functions in DrDustinEdwards/dustinedwards-info, at commit 1590ba4 on 2026-10-24. This file on GitHub.
Functions
| Function | Lines | Complexity | Covered | CRAP | Mutation |
|---|---|---|---|---|---|
| loader | 7 to 19 | 2 | No data: no coverage report in this map | No data: no coverage report in this map | No data: no mutants in this code |
Imports
It imports app/db/index.ts, app/lib/context.ts, app/lib/markdown-twin.ts, app/lib/seo.ts. No module of this repo imports it.
Source
import { getBlogPostMarkdown } from "~/db";
import { getEnv } from "~/lib/context";
import { markdownResponse } from "~/lib/markdown-twin";
import { SHARED_CACHE_CONTROL } from "~/lib/seo";
import type { Route } from "./+types/blog.$slug[.md]";
export async function loader({ params, context }: Route.LoaderArgs) {
const post = await getBlogPostMarkdown(getEnv(context), params.slug);
if (!post) {
return new Response("Not found\n", {
status: 404,
headers: { "content-type": "text/plain; charset=utf-8" },
});
}
/* Publicly cached: this URL has one representation, unlike the negotiated `/writing/:slug`. */
return markdownResponse(params.slug, post.body, SHARED_CACHE_CONTROL);
}