Custom servers with Fornax
I've done a little organizing to make it easier to customize the server.
At the bottom, there is a definition of a function called 'serve_url()'. Here is where the magic happens: you get a url, and you output something.
The default definition just serves files:
But you can do anything else here. For instance, if you want to show current time when the url is '/time', do this:
See it in action here:
gemini://spell.ddns.net:10965/
See the updated README.gmi for more information on how to hack Fornax
2025-09-14 ยท 8 months ago
2 Comments โ
๐ฝ spc476 ยท 2025-09-15 at 08:06:
Next up, define some structures to map routes to routines to run, like I've done in GLV-1.12558:
โ Sample config, check the handler section
๐ stack [OP/mod] ยท 2025-09-15 at 12:59:
I like your code, but I will probably not do that.
The goal of this project is a minimalistic drop-in server with a minimal footprint.
I don't really like the idea of supporting CGI variants or a complex routing mechanism for different directories. I'd rather run multiple application servers on different ports if I must.
And besides, so many other servers do that already (with various degrees of success, as I found out the hard way).
But there is nothing stopping someone else from adding a routing and configuration mechanism to Fornax.