Centralizes DI initialization in the root layout so individual pages and the tRPC route handler no longer need to import or call it.
32 lines
775 B
TypeScript
32 lines
775 B
TypeScript
import type { Metadata } from "next";
|
|
import "../styles/app.css";
|
|
import { getNonce } from "@repo/core-shared/security/next";
|
|
import { bindAll } from "../server/bind-production";
|
|
import { Providers } from "./providers";
|
|
|
|
export const metadata: Metadata = {
|
|
title: "Template — Next.js",
|
|
description: "Clean Architecture Monorepo Template",
|
|
};
|
|
|
|
export default async function RootLayout({
|
|
children,
|
|
}: {
|
|
children: React.ReactNode;
|
|
}) {
|
|
await bindAll();
|
|
const nonce = await getNonce();
|
|
|
|
return (
|
|
<html lang="en">
|
|
<head>
|
|
{/* nonce exposed to client so instrumentation-client.ts can read it */}
|
|
<meta name="csp-nonce" content={nonce} />
|
|
</head>
|
|
<body>
|
|
<Providers>{children}</Providers>
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|