import { Hono } from "npm:hono";
const app = new Hono();
app.get("/", async (c) => {
const response = await fetch("https://hacker-news.firebaseio.com/v0/topstories.json");
const storyIds = await response.json();
const storyResponse = await fetch(`https://hacker-news.firebaseio.com/v0/item/${storyIds[0]}.json`);
const story = await storyResponse.json();
return c.html(
<div>
<h1>{story.title}</h1>
<p>By {story.by}</p>
<p>{story.score} points</p>
<p>{story.descendants} comments</p>
<a href={story.url}>Read more</a>
</div>
);
});
export default app.fetch;