apps/web-next/src/server/bind-production.ts now exports three functions: - bindAllProduction() — production-only binders - bindAllDevSeed() — dev-seed-only binders (NEW, calls all 5 features) - bindAll() — dispatcher that branches on USE_DEV_SEED env var All page/route callers (page.tsx, about/page.tsx, blog/[slug]/page.tsx, api/trpc/[trpc]/route.ts) updated from bindAllProduction → bindAll so the env flag actually has effect. docs/architecture/di-explainer.html (NEW): standalone interactive page explaining the di/ folder file-by-file, the loading sequence (8 stages), the three binding kinds (.to / .toDynamicValue / .toConstantValue), an interactive three-mode picker showing how the same blogContainer state differs across default/dev-seed/production, a conditions table, and a final card on how tests bypass DI entirely. Sister page to data-flow-explainer.html. Refactor log entry + canonical doc updates follow in subsequent commits.
35 lines
915 B
TypeScript
35 lines
915 B
TypeScript
import { notFound } from "next/navigation";
|
|
import { appRouter } from "@repo/core-api";
|
|
import { bindAll } from "../../../server/bind-production";
|
|
|
|
type PageProps = {
|
|
params: Promise<{ slug: string }>;
|
|
};
|
|
|
|
export default async function BlogPostPage({ params }: PageProps) {
|
|
await bindAll();
|
|
const { slug } = await params;
|
|
const caller = appRouter.createCaller({});
|
|
const article = await caller.blog.articleBySlug({ slug });
|
|
|
|
if (!article) notFound();
|
|
|
|
return (
|
|
<main>
|
|
<article>
|
|
<header>
|
|
<h1>{article.title}</h1>
|
|
{article.createdAt ? (
|
|
<time dateTime={article.createdAt.toISOString()}>
|
|
{article.createdAt.toLocaleDateString()}
|
|
</time>
|
|
) : null}
|
|
</header>
|
|
<pre style={{ whiteSpace: "pre-wrap" }}>
|
|
{JSON.stringify(article.content, null, 2)}
|
|
</pre>
|
|
</article>
|
|
</main>
|
|
);
|
|
}
|