Val Town’s tag line:
If GitHub Gists could run And AWS Lambda was fun
Val Town’s runnable vals (their word for “gists”) can be triggered manually, via email, or as an HTTP endpoint or cron job.
I’m in. This is super fun.
QR code generator
Here’s a little QR code generator I cobbled together as a val:
Open embedded Val Town content
A few things to note here:
- Those imports are a tour de force: 1. A Val Town standard library module (
blob) 2. A user val imported as a module (html) 3. An npm module (qrcodeimported asnpm:qrcode) - A single val can handle multiple request methods via
req.method1.GETrequests to my val receive HTML 2. All other methods handle form data, then create and serve a QR code (if I wanted to be stricter, I could wrap this portion to check only forPOSTrequests) - Serverless functions use standard request and response objects 1.
Requestdocs on MDN 2.Responsedocs on MDN
Sure, the world doesn’t need another QR code generator, but imagine what you could do with these tools.
Secret generator
Here’s a secret generator I made. Goodbye, “keyboard cat”!
Open embedded Val Town content
Go ahead: treat yourself to a 64-byte secret. After all, you’re going to Val Town.