janet-lang / spork

Various Janet utility modules - the official "Contrib" library.
MIT License
122 stars 35 forks source link

Middlewares in http module #47

Closed pepe closed 3 years ago

pepe commented 3 years ago

Part of the circlet library was a small collection of middleware. We could add this to the HTTP module as well, if only as examples.

What do you think?

bakpakin commented 3 years ago

Yeah, middleware makes sense and I don't see a problem with it. Still, it should be farily minimalist imo, just simple things like a generic server handler, or auth handler, or logging handler, etc.

pepe commented 3 years ago

Indeed that is what I had on my mind. Circlet contains:

I would guess it is enough for the HTTP module too, and I can copy them verbatim from circlet if you agree or tell me which to copy.

bakpakin commented 3 years ago

I have copied over and modified all of the above middleware, and added a parser for query-strings (that was built into circlet).

pepe commented 3 years ago

I guess this new incarnation of Middleware is fine work. Thank you ❤️