Yohan Chalier Blog RSS

Curl Me!

I recently watched a YSAP video about building a website in Bash. The host had a clever idea: in the web server config, one may use the fact that the User-Agent header contains curl to serve a text file instead of an HTML file. This text file may contain ANSI escape codes for specifying color and styling.

I already have a Makefile for building the HTML index for my landing page. So, adding a text template was pretty straightforward. After fiddling a little with Apache's mod_rewrite rules (I really should refactor and cleanup my configs), it is live. You can access my website directly from the terminal! Just type:

curl chalier.fr
Screen recording of me typing it in my terminal

You may also get a list of my projects with:

curl chalier.fr/projects

On Windows, PowerShell provides a curl command, which actually is an alias to Invoke-WebRequest. The User-Agent contains the Powershell key, so it is also supported!