u-gronw.web.val.run
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()));
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
1
stevekrouse avatar

Very cool! This val deserves a README

v8
December 3, 2023