29 app.all("*", async (c) => {
30 const { path } = c.req;
31 return await fetch(`https://api.val.town${path}`, {
32 method: c.req.method,
33 headers: c.req.raw.headers,
1# Use GPT to generate vals on your account!
2
3Describe the val that you need, call this function, and you'll get a new val on your workspace generated by OpenAI's API!
4
5First, ensure you have a [Val Town API Token](https://www.val.town/settings/api), then call `@andreterron.createGeneratedVal({...})` like this [example](https://www.val.town/v/andreterron.untitled_tomatoKiwi):
6
7```javascript
1import { saveToTana } from "https://esm.town/v/impedivity/saveToTana";
2import { APIPlainNode } from "https://esm.town/v/nbbaier/tanaTypes";
3import { Hono } from "npm:hono";
4
5const token = Deno.env.get("tanaInputAPI");
6
7export const honoTanaEndpoint = async (req: Request) => {
10 let { text, url } = c.req.query();
11 console.log(c.req);
12 const payload: APIPlainNode = {
13 name: text,
14 children: [
1import { saveToTana } from "https://esm.town/v/impedivity/saveToTana";
2import { APIPlainNode } from "https://esm.town/v/nbbaier/tanaTypes";
3import { Hono } from "npm:hono";
4
5const token = Deno.env.get("tanaInputAPI");
6console.log(token);
7console.log(Request);
16 let { text, url } = c.req.query();
17 console.log(c.req);
18 const payload: APIPlainNode = {
19 name: text,
20 children: [
15
16// use my private proxy
17setEnv("VALTOWN_API_URL", "<proxy-url>");
18
19// wire sqlite explorer to a turso db !
1# lit
2
3[Lit](https://lit.dev/docs/ssr/server-usage/) is kind of like Google's answer to React: it's a little more reliant on browser APIs like custom elements and the shadow DOM, a little less 'magic', like using JSX.
4
5This is an example of using Lit and rendering it straight to a string, which is something that's recently popular. It works pretty well, right off the bat: Lit provides nice ESM modules and a pretty smooth workflow!
8
91. Click `Fork`
102. Change `location` (Line 4) to describe your location. It accepts fairly flexible English descriptions which it turns into locations via [nominatim's geocoder API](https://www.val.town/v/stevekrouse/nominatimSearch).
113. Click `Run`
12
13Change the `query` variable for what you want to get notified for.
14
15You can use [Twitter's search operators](https://developer.twitter.com/en/docs/twitter-api/v1/rules-and-filtering/search-operators) to customize your query, for some collection of keywords, filtering out others, and much more!
16
17## 3. Notification
16 <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
17 <style>
18 @import url("https://fonts.googleapis.com/css2?family=Inter:wght@500;700&display=swap");
19 @import url("https://esm.sh/tldraw@2.1.0/tldraw.css");
20
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