2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
1// This val demonstrates how to handle form data and display it back to the user
2
3export default async function server(req: Request): Promise<Response> {
4 if (req.method === 'POST') {
5 const formData = await req.formData();
12import { createRoot } from "https://esm.sh/react-dom/client";
13
14function App() {
15 const [coffeeShops, setCoffeeShops] = useState([]);
16 const [reviews, setReviews] = useState([]);
163}
164
165function client() {
166 createRoot(document.getElementById("root")).render(<App />);
167}
168if (typeof document !== "undefined") { client(); }
169
170async function server(request: Request): Promise<Response> {
171 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
172 const url = new URL(request.url);
14}
15
16function App() {
17 const [messages, setMessages] = useState<Message[]>([]);
18 const [newMessage, setNewMessage] = useState("");
92}
93
94function client() {
95 createRoot(document.getElementById("root")!).render(<App />);
96}
100}
101
102async function server(request: Request): Promise<Response> {
103 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
104 const SCHEMA_VERSION = 1;
1export async function fileToDataURL(file: File) {
2 const base64String = await fileToBase64(file);
3
9}
10
11export async function fileToBase64(file: File) {
12 // Read the file as an ArrayBuffer
13 const arrayBuffer = await file.arrayBuffer();
159];
160
161function App() {
162 const [selectedTech, setSelectedTech] = useState([]);
163 const [showInventory, setShowInventory] = useState(false);
251}
252
253function client() {
254 createRoot(document.getElementById("root")).render(<App />);
255}
257if (typeof document !== "undefined") { client(); }
258
259async function server(request: Request): Promise<Response> {
260 return new Response(
261 `
14};
15
16function App() {
17 const [selectedTech, setSelectedTech] = useState({});
18
64}
65
66function client() {
67 createRoot(document.getElementById("root")).render(<App />);
68}
69if (typeof document !== "undefined") { client(); }
70
71async function server(request: Request): Promise<Response> {
72 return new Response(`
73 <!DOCTYPE html>
5const { author, name } = extractValInfo(import.meta.url);
6
7export async function forwarder(e: Email) {
8 let attachments: AttachmentData[] = [];
9 for (const f of e.attachments) {
5const { author, name } = extractValInfo(import.meta.url);
6
7export async function forwarder(e: Email) {
8 let attachments: AttachmentData[] = [];
9 for (const f of e.attachments) {
6);
7
8export async function uptimeCheck(url: string) {
9 let ok = true;
10 let reason: string;
A helper function to build a file's email
Simple functional CSS library for Val Town
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(req: Request): Promise<Response> {
if (req.method === "OPTIONS") {
return new Response(null, {
headers: {
"Access-Control-Allow-Origin": "*",
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.