log truisms

This commit is contained in:
Chris Wanstrath 2026-01-28 11:08:09 -08:00
parent c51af0c98b
commit ac8a0c259a

View File

@ -4,8 +4,13 @@ const app = new Hono()
const html = (strings: TemplateStringsArray, ...values: any[]) => strings.reduce((result, str, i) => result + str + (values[i] || ''), '') const html = (strings: TemplateStringsArray, ...values: any[]) => strings.reduce((result, str, i) => result + str + (values[i] || ''), '')
const truism = (): string => {
const text = TRUISMS[Math.floor(Math.random() * TRUISMS.length)]!
console.log(text)
return text
}
app.get("/", (c) => { app.get("/", (c) => {
const truism = TRUISMS[Math.floor(Math.random() * TRUISMS.length)]
return c.html(html` return c.html(html`
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
@ -33,13 +38,13 @@ app.get("/", (c) => {
</style> </style>
</head> </head>
<body> <body>
<h1>${truism}</h1> <h1>${truism()}</h1>
</body> </body>
</html> </html>
`) `)
}) })
app.get("/txt", (c) => c.text(TRUISMS[Math.floor(Math.random() * TRUISMS.length)]!)) app.get("/txt", c => c.text(truism()))
export default { export default {
port: process.env.PORT || 3000, port: process.env.PORT || 3000,