the.bay.news

Middleware design seem very hard to do correct

Ziggit
Middleware design seem very hard to do correct
I’m creating an http micro-framework and the thing I can’t fully understand is middlewares. I’ve looked up zap to see how they do this, but they only do global chain of middlewares, which I don’t personally like. I would like to have global chains and per-route middlewares. But there’s another problem. Approach 1. Let’s say I create a logger: pub const Handler = struct { userdata: ?*anyopaque, call_fn: *const fn (?*anyopaque, Context) anyerror!void, }; pub const Logger = struct { ...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.