Readme

Slimmed down version of pomdtr/extractValInfo that focuses on extracting the HTTP endpoint URL of the Val.

Example usage:

const apiUrl = extractHttpEndpoint(import.meta.url);
1
2
3
4
5
6
export function extractHttpEndpoint(url: string | URL) {
const { pathname } = new URL(url);
const [author, filename] = pathname.split("/").slice(-2);
const [name] = filename.split(".");
return `https://${author}-${name}.web.val.run`;
}
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!
v2
May 29, 2024