You're going to Val Town

Val Town's runnable vals (their word for "gists") can be triggered manually, via email, or as an HTTP endpoint or cron job.

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:

A few things to note here:

  1. 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 (qrcode imported as npm:qrcode)
  2. A single val can handle multiple request methods via req.method
    1. GET requests 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 for POST requests)
  3. Serverless functions use standard request and response objects
    1. Request docs on MDN
    2. Response docs 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"!

Go ahead: treat yourself to a 64-byte secret. After all, you're going to Val Town.