Devlog 1 - Part 2 - Correcting for mistakes

Literally after I posed yesterdays devlog I realized "Wait how the hell do I account for SNI? How do I have gemini.senders.io/index.gmi and app.senders.io/index.gmi?

=> Yesterday's devlog

I got so use to running, if need be, smaller services (SOA style) behind an nginx or some other proxy that does the SSL handshake and then proxies over to another service to handle.

Since this will just be a monolith where you can run your different services under I need to add a host layer ontop of the router layer. I wanted to keep the heirarchy of:

1 Server -> multiple hosts -> multiple routers -> multiple routers.

The code

ResponseMessage response =
    hosts
        .filter(h -> h.hosts().equals(request.uri().getHost()))
        .flatMap(Host::routers)
        .flatMap(Router::routes)
        .filter(r -> RouteMatcher.match(r.route(), request.uri()))
        .findFirst()
        .map(r -> r.handle(request))
        .orElse(this.fallbackRouteHandler.handle(request.uri()));

Basically you'll be at the mercy of "first come first serve" (literally) but we:

The fallback handler is an idea that I am thinking we basically allow you to put int like maybe just try and serve anything we don't match as a file. But I have a feeling you'd handle that on the route level but registering essentially a /* route or something...

What's next

It will definetly take some time before I get this back into a working state. I've torn apart a lot of the sub-server layer that you'll be interfacing with as a developer and I want it to feel consistent.

Javadoc?

Something that piqued my interest was getting the javadoc on gemini. Most likely it'll have to be a hand written reference but there is an idea for you java devs bored looking for a project: Javadoc -> gemini processor!

I'm excited again

Thanks, I am excited again to actually push this thing out. I am also thinking of how to profile this app. So if you have ideas, or ways to test a gemini servers features...

Thanks again

Links

=> Gemlog | Home

Proxy Information
Original URL
gemini://senders.io/gemlog/2021-03-24-devlog-1-part-2-correcting-for-mistakes.gmi
Status Code
Success (20)
Meta
text/gemini; lang=en;
Capsule Response Time
801.101861 milliseconds
Gemini-to-HTML Time
0.738799 milliseconds

This content has been proxied by September (ba2dc).