4 ms·
I have not used aiohttp, but it looks like their application must be initialized with a list of middleware_factories. I do not see any logic in choosing middlew
by akubera 10y ago
I have not used aiohttp, but it looks like their application must be initialized with a list of middleware_factories. I do not see any logic in choosing middleware - just a straight shot.
Growler apps just add functions to an internal list, and these may be 'mounted' on particular end points/http requests.
Also, in aiohttp it is up to your endpoint to create the response object and return it. While in Growler it is created by the application (or rather the GrowlerHttpResponder) and passed around the middleware - getting enhancements (res.render('foo') is not standard) and having callbacks registered (to, say, log ALL headers sent - something you want done only at the time of sending headers).
I think it would be possible (or at least I would like to get to the point) where you could actually mount other apps from other frameworks into a Growler app. So if there is blog software you like written in aiohttp, there is special middleware to transform growler requests into a aiohttp requests.
import growler
import aiohttp.web
aio_blog_app = aiohttp.web.Application()
...
app = growler.App("main site")
app.use(GrowlerAiohttpMiddleware(aio_blog_app), path='/blog')
...
THAT would be kinda cool.