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");
}
}