Public
HTTP
pomdtr-examplearticle.web.val.run
February 12, 2024
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!
February 12, 2024