tmcw-hackernewstopstory.web.val.run
Readme

Something

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/** @jsxImportSource npm:hono@3/jsx */
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
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
July 23, 2024