200app.get('/test', (c) => c.html(htmlContent2));
201
202export default app.fetch; // val.town
203// Deno.serve(app.fetch); // deno.deploy
204
2import { Hono } from "npm:hono@3";
3
4// TODO: Fetch from key-value
5const profile = {
6 displayName: "Jordan",
169app.get("/", (c) => c.html(myspaceHtml(profile)));
170
171export default app.fetch;
133 return new Response(body, { headers: { "Content-Type": "text/event-stream" } });
134});
135export default app.fetch;
75});
76
77export default app.fetch;
10assistant > Here are a few fun Val ideas you could build on Val Town:
11
121. **Random Joke Generator:** Fetch a random joke from an API and display it.
132. **Daily Weather Update:** Pull weather data for your location using an API and create a daily summary.
143. **Mini Todo List:** Create a simple to-do list app with add, edit, and delete functionalities.
154. **Chuck Norris Facts:** Display a random Chuck Norris fact sourced from an API.
165. **Motivational Quote of the Day:** Fetch and display a random motivational quote each day.
17
18Which one sounds interesting to you?
35 );
36});
37export default app.fetch;
38```
16
17while (!message) {
18 const adviceResponse = await fetch("https://api.adviceslip.com/advice");
19 const adviceJson: AdviceResponse = await adviceResponse.json();
20 const newMessage = adviceJson.slip.advice + "@ x.arruda.dev/v";
65const defaultEmbeddingColumn = "Embeddings";
66
67async function fetchAirtableData(baseId, tableName, nameColumn, contentColumn, embeddingColumn) {
68 const base = new Airtable({ apiKey: airtableApiKey }).base(baseId);
69 const records = await base(tableName).select().all();
86
87 try {
88 const documents = await fetchAirtableData(baseId, tableName, nameColumn, contentColumn, embeddingColumn);
89 console.log('documents:', documents)
90 await semanticSearch.addDocuments({documents, fields: 'embeddingsContent'});
132});
133
134export default app.fetch;
135
18const defaultEmbeddingColumn = "Embeddings";
19
20async function fetchAirtableData(baseId, tableName, contentColumn, embeddingColumn) {
21 const base = new Airtable({ apiKey: airtableApiKey }).base(baseId);
22 const records = await base(tableName).select().all();
41
42 try {
43 const documents = await fetchAirtableData(baseId, tableName, contentColumn, embeddingColumn);
44 await semanticSearch.addDocuments(documents);
45
63
64 try {
65 const documents = await fetchAirtableData(baseId, tableName, contentColumn, embeddingColumn);
66 await semanticSearch.addDocuments(documents);
67
74});
75
76export default app.fetch;
8
9function esmTown(url) {
10 return fetch(url, {
11 headers: {
12 "User-Agent":
17
18const app = new Hono();
19export default app.fetch;
20
21app.get("/", async (c) =>