orthecreedence / wookie

Asynchronous HTTP server in common lisp
http://wookie.lyonbros.com/
MIT License
189 stars 19 forks source link

middleware? #53

Open orthecreedence opened 10 years ago

orthecreedence commented 10 years ago

I like express' middleware architecture way more than wookie's plugin architecture. However, where middleware falls flat is offering accessor/convenience functions. Once you build these in, you almost have plugins anyway. The idea of creating an ASDF package per-plugin is a bit obnoxious though.

Something to think about.

sudodoki commented 7 years ago

something that is not clear for me, as a newcomer – is there a way to 1) specify some of the plugins/hooks to fire only for specific routes - like protect with auth but only specific routes? 2) modify response body/headers in post hook so additional headers might be added (for things like providing CORS for some endpoints, etc?

orthecreedence commented 6 years ago

It's been a while since I worked on Wookie, so even though it is my project I am a bit rusty =].

From what it looks like, :pre-route and :port-route send in both request and response to the hooks. You should be able to manipulate the headers/data in these objects as much as you need. In the pre-route hook, you could read the path of the request and decide whether or not to act on that request (as opposed to attaching a hook directly to a route).

Hope this helps.