my-website-v2/frontend/routes/posts/[id].tsx

29 lines
649 B
TypeScript
Raw Normal View History

import { FreshContext, Handlers, PageProps } from "$fresh/server.ts";
2024-12-02 17:29:45 -06:00
interface PageData {
post_id: number;
first_nane: string;
last_name: string;
title: string;
body: string;
created_at: string;
2024-12-02 17:29:45 -06:00
is_featured: boolean;
}
2024-12-02 17:29:45 -06:00
export const handler: Handlers<PageData> = {
async GET(_req: Request, ctx: FreshContext) {
const postResult = await fetch(
`${Deno.env.get("BASE_URI_API")}/posts/${ctx.params.id}`,
);
const postData = await postResult.json();
return ctx.render({
postData,
});
},
};
export default function PostIdentifier({ data }: PageProps<PageData>) {
return <div className=""></div>;
}