FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
begoon
begoonthisval
Public
Like
3
thisval
Home
Code
2
README.md
S
main.tsx
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in miliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
9/11/2024
Viewing readonly version: 2
View latest version
README.md@2

This val default exports a function returning ValInfo.

The val information comes from the Deno stack trace induced by throw new Error().

type ValInfo = {
  stack: string[]; // mostly for debugging
  endpoint: string; // val endpoint URL, empty if it is not an HTTP val
  user: string; // val.town user name
  name: string; // val name
};

Here is an example program:

import thisval from "https://esm.town/v/begoon/thisval";
const val = thisval();
export default async function(req: Request): Promise<Response> {
  return Response.json(val);
}

when invoked, it returns:

{
  "stack": [
    "Error",
    "    at info (https://esm.town/v/begoon/thisval?v=12:10:11)",
    "    at https://esm.town/v/begoon/thisvaltest?v=2:3:13"
  ],
  "endpoint": "begoon-thisvaltest.web.val.run",
  "user": "begoon",
  "name": "thisvaltest"
}
Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.