No matches found in users.
Try switching to another result type using the tabs above.
You can access search results via JSON API by adding format=json
to your query:
https://codesearch.val.run/$%7Burl%7D?q=fetch&page=1&format=json
For typeahead suggestions, use the /typeahead
endpoint:
https://codesearch.val.run/typeahead?q=fetch
Returns an array of strings in format "username" or "username/projectName"
Found 14486 results for "fetch"(1585ms)
No matches found in users.
Try switching to another result type using the tabs above.
362
363try {
364// Fetch the source code
365const response = await fetch(sourceUrl);
366if (!response.ok) {
367return c.text(`Failed to fetch source: ${response.status}`, 404);
368}
369
611async function detectBlock(code, line, column) {
612if (blockDetectorUrl) {
613const response = await fetch(blockDetectorUrl, {
614method: 'POST',
615headers: { 'Content-Type': 'application/json' },
624async function explainBlock(code, blockInfo) {
625if (blockExplainerUrl) {
626const response = await fetch(blockExplainerUrl, {
627method: 'POST',
628headers: { 'Content-Type': 'application/json' },
770}
771772export default app.fetch;
39```
4041This will fetch the source from `https://esm.town/v/nbbaier/sqliteExplorerApp@100-main/main.tsx` and display it with annotations.
4243### Custom Functions
1361371. **URL Parsing**: Extracts the val path from the URL
1382. **Source Fetching**: Fetches source code from `https://esm.town/v/{path}`
1393. **Language Detection**: Determines language from file extension
1404. **Syntax Highlighting**: Applies syntax highlighting using Prism.js
155## Error Handling
156157- Returns 404 if the source URL cannot be fetched
158- Returns 400 for invalid path formats
159- Returns 500 for other errors with error messages