pomdtr-examplearticle.web.val.run
Readme

Example Article

More detail on the discovery mechanism here.

Fork this val to create a new post!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// title: Example Article
import { article } from "https://esm.town/v/pomdtr/article";
import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo";
import { html } from "https://esm.town/v/stevekrouse/html?v=5";
export async function exampleArticle(req: Request) {
const { author, name } = extractValInfo(import.meta.url);
if (new URL(req.url).pathname == "/edit") {
return Response.redirect(`https://val.town/v/${author}/${name}`);
}
return html(await article(author, name));
}
// #blog
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
v7
February 12, 2024