(Example) Update with-opentelemetry example. (#54775)

Updated with new `Metadata` API.


Here in this example there is `legacy.tsx` in `/pages`  folder should i remove it or retain it??
Also in `/pages/legacy.tsx` we have defined `/preact-stars` route but we don't have the corresponding file. 
I have remove `/preact-stars` from `/app/page.tsx` as there is no `/app/preact-stars/page.tsx` in this example.
And `/shared/fetch-github-stars.ts` is fetching only `next.js` stars.

Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
This commit is contained in:
vinay 2023-09-26 08:26:23 +05:30 committed by GitHub
parent e94868215d
commit c56f9f4ff9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 15 deletions

View file

@ -1,12 +1,18 @@
export default function Layout({ children }) {
import type { Metadata } from 'next'
export const metadata: Metadata = {
title: 'Next.js with OpenTelemetry',
description: 'Next.js with OpenTelemetry',
}
export default function RootLayout({
children,
}: {
children: React.ReactNode
}) {
return (
<html>
<head>
<title>Next.js with OpenTelemetry</title>
</head>
<body>
<main>{children}</main>
</body>
<html lang="en">
<body>{children}</body>
</html>
)
}

View file

@ -1,12 +1,6 @@
import Link from 'next/link'
import { fetchGithubStars } from '../shared/fetch-github-stars'
export default async function Page() {
const stars = await fetchGithubStars()
return (
<>
<p>Next.js has {stars} </p>
<Link href="/preact-stars">How about preact?</Link>
</>
)
return <p>Next.js has {stars} </p>
}