Fetch the source of a val
This val was created before the introduction of https://esm.town
Usage
curl https://pomdtr-raw.web.val.run/<author>/<name>.<extension>[?v=<version>]
To see the code of this val, use https://pomdtr-raw.web.val.run/pomdtr/raw.ts
Examples
Fetching the val code
$ curl https://pomdtr-raw.web.val.run/pomdtr/add.tsx
You can also use js
, jsx
and ts
extension (only the content-type change, there is no transpilation).
Fetching private val
Pass an api token as an username
$ curl "https://<token>@pomdtr-raw.web.val.run/pomdtr/privateVal.ts"
Fetching the val README
$ curl https://pomdtr-raw.web.val.run/pomdtr/add.md
Getting an image
$ curl https://pomdtr-raw.web.val.run/pomdtr/add.png
Fetching a specific version of a val
$ curl https://pomdtr-raw.web.val.run/pomdtr/raw.ts?v=66
You need to be authenticated to use this method.
Fetching the val metadata
$ curl https://pomdtr-raw.web.val.run/pomdtr/add.json
Running vals locally using Deno
Create a new val.ts
file referencing the @pomdtr.add
import { add } from "https://pomdtr-raw.web.val.run/pomdtr/add.ts";
console.log(add(1, 2));
then use deno run
$ deno run ./val.ts
3
If you val accept a request and return a response, you can pass it to Deno.Serve
to run it locally!
import {raw} from "https://pomdtr-raw.web.val.run/pomdtr/raw.ts";
Deno.serve(raw);
If your val is private, you can set the DENO_AUTH_TOKENS env.
DENO_AUTH_TOKENS=<val-town-token>@pomdtr-raw.web.val.run
jsr2gh
Redirect to jsr package's GitHub repository page, like vladimyr-jsr2gh.web.val.run/@luca/flag
Usage
https://vladimyr-jsr2gh.web.val.run/<scope>/<name>
Example
@postpostscript/readmeManager: Edit Val Readmes With Persistent Drafts
Todo:
- Upload images
- Autosave/save without reloading page
- Ctrl+S
- Multiple draft versions
- Switch to dark codemirror theme which has markdown styling
- Allow for checking checkboxes in preview
- View with just the preview
- Ability to favorite vals on the Home page
This val is supposed to be used with the val.town extension. See the extension readme for installation instructions.
Use readme as website
Usage
See this val http endpoint as an example: https://pomdtr-article.web.val.run
See SQLite Explorer for information!
Lowdb Example
This val demonstrates the integration between valtown and lowdb.
Read the Lodash section if you want to give superpowers to your DB.
Importing a readme from another readme 🤯
import Readme from "https://pomdtr-mdx_readme.web.val.run/mod.js"
Usage:
Create valimport blobEditor from "https://esm.town/v/pomdtr/blob_editor"
export default blobEditor("article.md")
You can easily protect your val behind @pomdtr/passwordAuth or @pomdtr/emailAuth
export const title = "mdx"
{title}
Usage
Create valimport { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo";
import { mdx } from "https://esm.town/v/pomdtr/mdx";
const { author, name } = extractValInfo(import.meta.url);
export default mdx(author, name);
Authentication middleware
Guards your public http vals behind a login page.
This val use a json web token stored as an http-only cookie to persist authentication.
Usage
Set an AUTH_SECRET_KEY
env variable (used to sign/verify jwt tokens). Use an API token to authenticate.
import { auth } from "https://esm.town/v/pomdtr/auth_middleware";
async function handler(req: Request): Promise<Response> {
return new Response("You are authenticated!");
}
export default auth(handler);
See @pomdtr/test_auth for an example
⚠️ Make sure to only provides your api token to vals you trust (i.e. your own), as it gives access to your whole account.