1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { gron } from "https://esm.town/v/u/gron";
export default async function untitled_roseClownfish(req: Request): Promise<Response> {
let url: URL;
try {
url = new URL(new URL(req.url).searchParams.get("url"));
}
catch {
return new Response(
"<html><body>Not a valid URL - " + new URL(req.url).search
+ "</body></html>",
{
headers: {
"Content-Type": "text/html",
},
},
);
}
return new Response(gron(await (await fetch(url)).json()));
}
šŸ‘† This is a val. Vals are TypeScript snippets of code, written in the browser and run on our servers. Create scheduled functions, email yourself, and persist small pieces of data ā€” all from the browser.