Search
testeExpressEndpoint
@dev_pioneiro
An interactive, runnable TypeScript val by dev_pioneiro
Script
export function testeExpressEndpoint(req: express.Request, res: express.Response) {
console.log("@testeVal.context => ", req.body);
wordcounter
@yawnxyz
finally a word counter without ads surprisingly annoying to make. Weird text encodings from pasted text turns characters into spaces, or spaces don't "count" as spaces for some reason
HTTP
finally a word counter without ads
surprisingly annoying to make. Weird text encodings from pasted text turns characters into spaces, or spaces don't "count" as spaces for some reason
const app = new Hono();
const html = `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Word Counter</title>
simpletext
@nbbaier
An implementation of simpletext blog by jonfraser . Installation info coming later.
HTTP
An implementation of [simpletext blog](https://github.com/jonfraser/simpletext) by [jonfraser](https://github.com/jonfraser).
Installation info coming later.
const [author, filename] = new URL(import.meta.url).pathname.split("/").slice(-2);
const [name] = filename.split(".");
const nameSpacePrefix = "posts";
const baseUrl = `https://${author}-${name}.web.val.run/`;
const htmlUrl = `https://val.town/v/${author}/${name}`;
const blogTitle = "SimpleText Blog";
const blogSubtitle = "Val Town Edition";
const blogDescription = "This is a simpletext RSS feed.";
spotify_helpers
@stevekrouse
@jsxImportSource https://esm.sh/hono@3.9.2/jsx
Script
/** @jsxImportSource https://esm.sh/hono@3.9.2/jsx **/
export const home = c =>
c.html(
<div>
<h1>Get your Spotify Access Token</h1>
<p>
This app uses{" "}
<a href="https://developer.spotify.com/documentation/general/guides/authorization-guide/#authorization-code-flow">
Authorization Code Flow
</a>{" "}
Dice
@lalowebos
An interactive, runnable TypeScript val by lalowebos
HTTP
HTML CSS JS Result Skip Results Iframe
<html>
<head>
<title>Dice Simulator 2015</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<p id="placeholder">
</p>
<button id="button">Roll Dice</button>
aqi
@raei
An interactive, runnable TypeScript val by raei
Script
import { easyAQI } from "https://esm.town/v/stevekrouse/easyAQI?v=3";
export async function aqi(location = "Berlin") {
const data = await easyAQI({ location });
if (data.severity.includes("Unhealthy")) {
console.email(
"Air Quality: " + data.severity,
`AQI in ${location} is ${data.aqi}`
return data;
parsePdfData
@speepo
// THE PDF LIBRARY PROBABLY WON'T WORK WITH THE CODE AS IT IS
Express (deprecated)
// NOT FUNCTIONAL
// THE PDF LIBRARY PROBABLY WON'T WORK WITH THE CODE AS IT IS
export const parsePdfData = (req: express.Request, res: express.Response) => {
console.log("start parsePdfData");
// A visit from a web browser? Serve a HTML page with a form
if (req.method === "GET") {
return res.send(`
<!DOCTYPE html>
<html>
<head>
pekoExample
@tmcw
peko This is an example of using the tiny peko example with Val Town - it's a small router that lets you build web apps using the standard Request & Response objects. Peko just provides routing - matching URLs with functions - and lets you create your own Response object. Server examples Hono Peko Itty Router Nhttp
HTTP
# peko
This is an example of using the tiny [peko](https://peko.deno.dev/) example with Val Town - it's a small router that lets you build web apps using the standard [Request](https://developer.mozilla.org/en-US/docs/Web/API/Request) & [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) objects.
Peko just provides routing - matching URLs with functions - and lets you create your own Response object.
### Server examples
- [Hono](https://www.val.town/v/tmcw.honoExample)
- [Peko](https://www.val.town/v/tmcw.pekoExample)
export const pekoExample = async (request) => {
const Peko = await import("https://deno.land/x/peko@2.0.0/mod.ts");
const server = new Peko.Router();
server.get("/", () => new Response("Yes? There’s something at /hello"));
pushplus
@yieldray
get token from: https://www.pushplus.plus/push1.html
Script
get token from: <https://www.pushplus.plus/push1.html>
export function pushplus(options: {
token: string;
title?: string;
content: any;
template?:
| "html"
| "txt"
| "json"
| "markdown"
valle_tmp_77183865308193063054442024667199
@janpaul123
// This val simply responds to all HTTP requests with "Hello world"
HTTP
// This val simply responds to all HTTP requests with "Hello world"
export default async function main(req: Request): Promise<Response> {
return new Response("Hello world");
SpotifyListening
@iamseeley
An interactive, runnable TypeScript val by iamseeley
Script
/** @jsx jsx */
/** @jsxFrag Fragment */
import { jsx, Fragment } from 'https://deno.land/x/hono/middleware.ts'
export defualt funtion SpotifyListening({}) {
return (
testCache
@pomdtr
An interactive, runnable TypeScript val by pomdtr
HTTP
const cache = await caches.open("valtown")
export default async function(req: Request) {
const cached = await cache.match(req)
if (cached) {
return cached
await cache.put(req, new Response("cached"))
return new Response("not cached")
zsjtest
@zsj1zsj
An interactive, runnable TypeScript val by zsj1zsj
Script
import { consoleTest } from "https://esm.town/v/xuer/consoleTest?v=1";
export let zsjtest = consoleTest();
pekoExample
@maxm
An interactive, runnable TypeScript val by maxm
HTTP
import * as Peko from "https://deno.land/x/peko@2.0.0/mod.ts";
export const pekoExample = async (request) => {
const server = new Peko.Router();
server.get("/", () => new Response("Yes? Peko is also serving something at /hello"));
server.get("/hello", () => new Response("Hello world!"));
return server.requestHandler(request);
cleanup
@websandbox
An interactive, runnable TypeScript val by websandbox
Cron
export default async function(interval: Interval) {
for (const b of await blob.list("play_")) {
if ((new Date(b.lastModified).valueOf() + EXPIRY) < Date.now()) {
try {
const resolved = await alias({
username: "websandbox",
valName: b.key,
token: Deno.env.get("valtown"),
await deleteVal({
id: resolved.id,