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/v/<author>/<name>.<extension>[?v=<version>]

To see the code of this val, use https://pomdtr-raw.web.val.run/v/pomdtr/raw.ts

Examples

Fetching the val code

$  curl https://pomdtr-raw.web.val.run/v/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/v/pomdtr/privateVal.ts"

Fetching the val README

$ curl https://pomdtr-raw.web.val.run/v/pomdtr/add.md

Getting an image

$ curl https://pomdtr-raw.web.val.run/v/pomdtr/add.png

Fetching a specific version of a val

$ curl https://pomdtr-raw.web.val.run/v/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/v/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/v/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/v/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 deno run val.ts