39
40```ts
41const res = await fetch("https://std-rpc_example.web.val.run/?args=[2,3]");
42console.log(await res.json()); // 5
43```
46
47```ts
48const res = await fetch("https://std-rpc_example.web.val.run/", {
49 method: "POST",
50 body: JSON.stringify({ args: [2, 3] })
71}
72
73export const blog = app.fetch;
74
75// #blog
1import { fetchConfirmationHtml } from "https://esm.town/v/petermillspaugh/fetchConfirmationHtml";
2import { fetchSignupHtml } from "https://esm.town/v/petermillspaugh/fetchSignupHtml";
3import { markLessonComplete } from "https://esm.town/v/petermillspaugh/markLessonComplete";
4import { refreshToken } from "https://esm.town/v/petermillspaugh/refreshToken";
16
17 app.get("/", async (c) => {
18 return c.html(fetchSignupHtml());
19 });
20
32
33 // Lack of await is intentional: send optimistic success response, then send email and notify myself async
34 sendVerification({ emailAddress: email, html: fetchConfirmationHtml({ email, token }) });
35
36 return Response.json({ success: true, message: "Sent verification email." });
46 sendVerification({
47 emailAddress: email,
48 html: fetchConfirmationHtml({ email, token: newToken, reVerifying: true }),
49 });
50
102 });
103
104 return app.fetch(req);
105}
3 export default async function uploadByURL(url){
4 try {
5 const urlStream = await fetch(url)
6 const arrayBuffer = await urlStream.arrayBuffer()
7 const blob = new Blob([arrayBuffer])
9 const data = new FormData()
10 data.append("file", blob)
11 const upload = await fetch('https://api.pinata.cloud/pinning/pinFileToIPFS', {
12 method: 'POST',
13 headers: {
2
3export default async function(ctx: BrowserContext) {
4 const resp = await fetch("https://api.iconify.design/collection?prefix=heroicons");
5 if (!resp.ok) {
6 throw new Error(await resp.text());
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const glifJson = async (id: string) => {
14 const url = `https://alpha.glif.xyz/api/glifs?id=${id}`;
15 try {
16 const response = await fetch(url);
17 if (!response.ok) {
18 throw new Error(`HTTP error! status: ${response.status}`);
1import { verify_discord_signature } from "https://esm.town/v/mattx/verify_discord_signature";
2import { formatInput } from "https://esm.town/v/rayman/formatInput";
3import { fetch } from "https://esm.town/v/std/fetch";
4import { example1 } from "https://esm.town/v/stevekrouse/example1?v=3";
5import process from "node:process";
48 content: `${
49 JSON.stringify(
50 await (await fetch(
51 "https://api.val.town/v1/eval/"
52 + encodeURIComponent(req.body.data.options[0].value),
4export default async function(ctx: BrowserContext<{ user: string }>) {
5 const { user: userID } = ctx.params;
6 const resp = await fetch(`https://api.val.town/v1/users/${userID}/vals?limit=100`, {
7 headers: {
8 Authorization: `Bearer ${Deno.env.get("valtown")}`,
1import { verify_discord_signature } from "https://esm.town/v/mattx/verify_discord_signature";
2import { formatInput } from "https://esm.town/v/rayman/formatInput";
3import { fetch } from "https://esm.town/v/std/fetch";
4import { example1 } from "https://esm.town/v/stevekrouse/example1?v=3";
5import process from "node:process";
66 break;
67 case "eval":
68 const evalResponse = await fetch(
69 `https://api.val.town/v1/eval/${encodeURIComponent(body.data.options[0].value)}`,
70 { headers: { "Content-Type": "application/json" } },
8 const order = ["created_at DESC", "id DESC"]; // Sorting order for comments
9 const timestamp = "2024-01-19T17:00:00.000Z"; // Filtering criteria
10 const page = 1; // Page number to fetch
11 // Invoke the function from the other Val
12 const constructedUrl = ConstructReadTangleUrl2(timestamp);