Curling ysap.sh does not return HTML. It returns a fully rendered terminal UI: pixel-art
header, bordered panels, a two-column layout, colored links. The kind of thing you’d
expect from a TUI app, delivered over plain HTTP.
The trick: check the User-Agent header. When it starts with curl/, respond with
ANSI escape codes and box-drawing characters. When it’s a browser, respond with HTML.
Same URL, two completely different experiences.
The source is on GitHub and shows a clean Node.js implementation. What’s worth stealing: the layout approach (panels, columns, a legend of available curl endpoints) and the idea that your API docs or personal site can have a zero-install CLI interface for free.
Nothing forces a server to return HTML. ANSI over HTTP is valid, useful, and kind of delightful.