Public
HTTP (deprecated)
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Readme
1
2
3
4
5
6
7
8
9
10
11
import { httpRegex } from "https://esm.town/v/stevekrouse/httpRegex";
export function lookup(req) {
try {
let url = new URL(req.url);
const [, handle, name] = url.pathname.match(httpRegex);
return Response.redirect(`https://val.town/v/${handle}/${name}`);
} catch (e) {
return new Response("Could not parse val name from web val URL");
}
}
stevekrouse-lookup.web.val.run
November 2, 2023