18 return serveFile(path, import.meta.url);
19 }
20 if (path.startsWith("/api/list")) {
21 // Get all rows from lab_upload_blobs
22 const response = await sqlite.execute(`
26 return Response.json({ ok: true, rows: response.rows });
27 }
28 if (path.startsWith("/api/upload")) {
29 return upload(req);
30 }
31 if (path.startsWith("/api/delete")) {
32 return _delete(req);
33 }
28 formData.append("url", url);
29 formData.append("send_replies", "true");
30 const result = await fetch("https://oauth.reddit.com/api/submit", {
31 method: "POST",
32 headers: {
43
44 try {
45 const response = await fetch("/api/create-branch", {
46 method: "POST",
47 headers: {
27 <head>
28 <title>SQLite Explorer</title>
29 <link rel="preconnect" href="https://fonts.googleapis.com" />
30
31 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
32 <link
33 href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@300..700&family=Source+Sans+3:ital,wght@0,200..900;1,200..900&display=swap"
34 rel="stylesheet"
35 />
7 <meta name="viewport" content="width=device-width, initial-scale=1.0">
8 <title>Cremini</title>
9 <link rel="preconnect" href="https://fonts.googleapis.com">
10 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
11 <link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&display=swap" rel="stylesheet">
12 <style>
13 body {
61 I'm being so specific with the name of the variable because that's industry standard.</li>
62 <li>The next step is to manipulate the request so it can be useful. There are a lot
63 of ways to manipulate the object and if you're curious read <a href="https://developer.mozilla.org/en-US/docs/Web/API/FormData#instance_methodsrun">this documentation</a>.
64 The way we're using is .getAll(). The name of the const variable doesn't matter. The input to .getAll()
65 is the value of the name attribute. Since I realized my description might not be clear,
6 "description": "A sample blah manifest demonstrating various tool types and configurations.",
7 "env": {
8 "OPENAI_API_KEY": Deno.env.get("OPENAI_API_KEY"),
9 },
10 "tools": [
1# Val Town Project Utilities
2
3These utils are very rapidly developing, so expect breaking changes.
4
5* file - reading files and directories in Projects
27 <a href="https://github.com/wkrouse">Github</a>
28 </nav>
29 <h1>How to make a PUT request with the Fetch API</h1>
30 <p> This page is a guide on how to PUT request with the Fetch API. First I'm going to
31 explain what why we're using the Fetch API. Then I'll explain what it is and the Val Town variant.
32 Finally I'll walk you through modifying the code example so that it allows you to replacing name with a
33 different name.</p>
34
35 <p>The reason we need to use the Fetch API is that the HTML form only works
36 for GET and POST methods. </p>
37
1/** @jsxImportSource npm:hono@3/jsx */
2import { frameHtml } from "https://esm.town/v/moe/frameHtml";
3import { getLaunches } from "https://esm.town/v/moe/spacexapi";
4import { spacexCalendar } from "https://esm.town/v/moe/spacexcalendar";
5import { getChartUrl } from "https://esm.town/v/moe/spacexchart";
83 {
84 /* <div class="mb-3">
85 <a href="/api" target="_blank">API</a>
86 </div>
87 <div class="mb-4">