Public
Script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=42";
import { api } from "https://esm.town/v/pomdtr/api";
import { BrowserContext } from "https://esm.town/v/pomdtr/browser";
export default async function(ctx: BrowserContext) {
const val = await fetchJSON("https://api.val.town/v1/vals", {
headers: {
Authorization: `Bearer ${Deno.env.get("valtown")}`,
},
method: "POST",
body: JSON.stringify({
code: "console.log('a')",
}),
});
return {
type: "open",
url: `https://val.town/v/${val.author.username}/${val.name}`,
};
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
February 22, 2024