misty heron
Express serverPlaceholder images for a layout that is waiting for its pictures. Ask for a size, get an SVG of that size that says how big it is.
Use it
GET /<width>x<height>.svg
GET /<width>x<height>.svg?bg=<hex>&fg=<hex>
- Width and height are whole numbers from 1 to 4000.
bgis the background andfgthe text, each exactly 3 or 6 hex digits, without#. Both are optional.- The image says its size and nothing else; there is no parameter for text. Any other parameter, size or colour is a 400.
- An image never changes, so it is sent to be cached for a year.
Examples
/320x180.svg: the default colours/120x120.svg?bg=162028&fg=f1efe9: dark, with light text/480x80.svg?bg=f8c5c6&fg=bf2f1c: a banner, with three colours of the page/64x64.svg?bg=2a5dc2&fg=fff: three hex digits work tooHow it runs
-
There is no Dockerfile. Tori finds
expressinpackage.json, builds an image from the source and runsnpm start. - Every image is drawn on request. When nobody visits for a while the server naps, and the next request wakes it, which takes a moment longer than the ones after it.
- This copy of the server started .
Deploy your own
With Node.js installed:
git clone https://github.com/tori-host/examples
cd examples/misty-heron
npx tori.host
The build runs on Tori, so nothing needs installing first. The first run creates a service under a new name of
its own and writes it to tori.json, so that the next run updates the same service.