• pomdtr avatar
    valtownByExample
    @pomdtr
    Val town by example Usage Simple Example To add an example, just create a val. The val should start with a JSDoc style multi line comment that describes the example: /** * @title HTTP server: Hello World * @description An example of a HTTP server that serves a "Hello World" message. */ // this comment will be displayed on the left export const server = () => new Response("Hello world!") The title is required. Then, you can write the code. Code can be prefixed with a comment that describes the code. The comment will be rendered next to the code in the example page. Make sure your val is public, then go to https://pomdtr-val_town_by_example.web.val.run/v/<your-username>/<your-val> Using multiple vals You can add another val to your example by adding an @include directive /** * @title HTTP server: Hello World * @description An example of a HTTP server that serves a "Hello World" message. * @include pomdtr/secondary_val */ See @pomdtr/react_example Adding external resources to your example You can attach an external link to your val by using the @resource directive. External resources are specified using a markdown link. /** * @title HTTP server: Hello World * @description An example of a HTTP server that serves a "Hello World" message. * @resource [Val Town Docs](https://docs.val.town) **/ Adding examples to the homepage Just add your val in @pomdtr/val_town_by_example_toc
    HTTP (deprecated)
  • tmcw avatar
    whenfilmed
    @tmcw
    A game where you guess when a movie was released. Man, those Disney movies are ancient !
    HTTP
  • maxm avatar
    plumWarbler
    @maxm
    An interactive, runnable TypeScript val by maxm
    Script
  • pomdtr avatar
    valTownSearch
    @pomdtr
    Val Town Search Search for vals using the Github API. Either use the provided UI, or the query param: https://val-town-search.pomdtr.me/search?q=fetchJSON How does it work ? I've wrote about it! Todos [x] Embed the results in the UI [x] Refresh the vals on a cron using a github action [ ] Improve layout on small screens [ ] Support json Accept header [ ] Add pagination params [ ] Allow to filter by authors
    HTTP (deprecated)
  • kortina avatar
    subaudio
    @kortina
    Forked from substrate/subaudio
    HTTP (deprecated)
  • stevekrouse avatar
    gitReleaseNotes
    @stevekrouse
    Forked from kylem/gitReleaseNotes
    HTTP (deprecated)
  • pomdtr avatar
    indieauth_server
    @pomdtr
    @jsxImportSource npm:hono/jsx
    HTTP (deprecated)
  • stevekrouse avatar
    hardwarebingo
    @stevekrouse
    Hardware Startup 2024 Bingo Made with Claude Artifacts
    HTTP (deprecated)
  • substrate avatar
    gifStory
    @substrate
    Generates a story and then a storyboard with 5 animated frames. Note : You'll need to fork this example (and un-comment some code) to run it with new input. Currently it renders cached output, for demo purposes (running takes 30-60s). šŸŖ© To fork, sign up for Substrate to get your own API key and $50 free credits
    HTTP (deprecated)
  • gitgrooves avatar
    VALLE
    @gitgrooves
    Forked from janpaul123/VALLE
    HTTP (deprecated)
  • pomdtr avatar
    excalidraw
    @pomdtr
    Excalidraw, embedded inside Val Town ! The drawing will be persisted in your blobs as json / png / svg. You can access the drawing source directly using the /json , /png and /svg subpaths. For example, to embed the image in a markdown document, you can use: ![pomdtr-excalidraw.web.val.run](https://pomdtr-excalidraw.web.val.run/png)
    HTTP (deprecated)
  • vladimyr avatar
    keyvhq_blob_example2
    @vladimyr
    Forked from vladimyr/keyvhq_example2
    Script
  • nbbaier avatar
    lowdbTest
    @nbbaier
    Forked from pomdtr/lowdb_example
    HTTP (deprecated)
  • vladimyr avatar
    bookmarklets
    @vladimyr
    Forked from pomdtr/bookmarklets
    HTTP (deprecated)
  • stevekrouse avatar
    grievingYellowAsp
    @stevekrouse
    Forked from stevekrouse/perf
    HTTP
  • postpostscript avatar
    blogSqliteUniversePart2
    @postpostscript
    sqliteUniverse: Make SQLite Queries Against Multiple Endpoints in Deno (Val Town) (Part 2) If you haven't already, check out Part 1 for an overview of this system! Examples Example: find my vals that are related to my public tables import { Statement } from "https://esm.town/v/postpostscript/sqliteBuilder"; import { sqliteUniverse } from "https://esm.town/v/postpostscript/sqliteUniverse"; console.log(await Statement` SELECT v.name AS val, t.name AS "table" FROM "https://postpostscript-sqlitevals.web.val.run/vals" v INNER JOIN "https://postpostscript-sqlitepublic.web.val.run/sqlite_schema" t ON t.name LIKE ('https://postpostscript-sqlitepublic.web.val.run/' || v.name || '%') AND t.type = 'table' WHERE v.author_username = 'postpostscript' `.execute({ sqlite: sqliteUniverse, })) Since table names matching /^@/ will let you pass val names in the place of their HTTP endpoints, we can write the query as: SELECT v.name AS val, t.name AS "table" FROM "@postpostscript/sqliteVals/vals" v INNER JOIN "@postpostscript/sqlitePublic/sqlite_schema" t ON t.name LIKE ('@postpostscript/sqlitePublic/' || v.name || '%') AND t.type = 'table' WHERE v.author_username = 'postpostscript' The result for the latter: [ { val: "authId", table: "@postpostscript/sqlitePublic/authIdExampleComments_comment" }, { val: "authIdExampleComments", table: "@postpostscript/sqlitePublic/authIdExampleComments_comment" } ] Example: query against a backup import { sqliteFromBlob } from "https://esm.town/v/postpostscript/sqliteBackup"; import { Statement } from "https://esm.town/v/postpostscript/sqliteBuilder"; import { defaultPatterns, patterns, sqliteUniverseWithOptions } from "https://esm.town/v/postpostscript/sqliteUniverse"; const sqlite = sqliteUniverseWithOptions({ interfaces: { patterns: [ ...defaultPatterns, patterns.blob, ], }, }); console.log(await Statement` SELECT * FROM "blob://backup:sqlite:1709960402936/someTable" `.execute({ sqlite })); Example: query from @std/sqlite and public data simultaneously import { sqliteFromBlob } from "https://esm.town/v/postpostscript/sqliteBackup"; import { Statement } from "https://esm.town/v/postpostscript/sqliteBuilder"; import { defaultPatterns, sqliteUniverseWithOptions } from "https://esm.town/v/postpostscript/sqliteUniverse"; import { sqlite as sqlitePrivate } from "https://esm.town/v/std/sqlite?v=4"; const sqlite = sqliteUniverseWithOptions({ interfaces: { patterns: defaultPatterns, fallback({ endpoint, tables }) { return sqlitePrivate }, }, }); console.log(await Statement` SELECT t.*, p.* FROM privateTable t JOIN "@example/sqlitePublic/publicTable" p `.execute({ sqlite })); You could also do it like this to make it more explicit: const sqlite = sqliteUniverseWithOptions({ interfaces: { exact: { "@std/sqlite": sqlitePrivate, }, patterns: defaultPatterns, }, }); console.log(await Statement` SELECT t.*, p.* FROM "@std/sqlite/privateTable" t JOIN "@example/sqlitePublic/publicTable" p `.execute({ sqlite })); Next Steps I'd like to make patterns to allow queries against JSON and Val/ESM exports e.g. SELECT * FROM "json://example.com/example.json" or SELECT * FROM "export://@postpostscript/someVal/someExport" but those will have to come later! Another necessary feature for querying against larger databases will be to use the WHERE or JOIN conditions when dumping from them, but this will be more complicated P.S. This has been a super fun project to work on and I hope you find it interesting or inspiring too! Let me know if you find any errors in this post or if you'd like me to expand more on a specific feature, and let me know if you make anything cool with this and I'll make a note of it! P.P.S (šŸ˜) this interface is not 100% stable yet, so I would recommend pinning to specific versions if it not breaking is important to you P.P.P.S. Want to serve your own public SQLite endpoints? This is currently the simplest example I have of how to do that: @postpostscript/sqlitePublic
    HTTP (deprecated)
May 30, 2024