// pages/share/[id].tsx import Head from "next/head"; import type { GetServerSideProps } from "next"; interface FileDetails { name: string; size: number; owner: string; uploadDate: string; id: string; url: string; } export const getServerSideProps: GetServerSideProps = async (context) => { const id = context.query.id as string; const res = await fetch(`${process.env.NEXT_PUBLIC_BASE_URL}/api/share?id=${id}`); if (!res.ok) { return { notFound: true, }; } const fileDetails: FileDetails = await res.json(); return { props: { fileDetails, }, }; }; export default function SharePage({ fileDetails }: { fileDetails: FileDetails }) { return ( <> {fileDetails.name}

File: {fileDetails.name}

Size: {(fileDetails.size / 1024).toFixed(2)} KB

Uploaded by: {fileDetails.owner}

); }