Welcome the channel on the development of Cro, a set of libraries for building reactive distributed systems, lovingly crafted to take advantage of all the Raku Programming Language has to offer (cro.services). This channel is being logged for historical purposes.
Set by lizmat on 24 May 2021.
16:50 whatnext joined
whatnext hello all :) I have a basic question about organising routes: say I have some routes, and I want e.g. a new database connection each time any route is called, so my routes might be like `get -> 'page' { $db_connection.do_something() }` - how can I avoid explicitly creating $db_connection in every route? 16:52
lizmat whatnext: most people here are currently away 17:04
whatnext: cro.services/docs/reference/cro-ht...middleware may be of help? 17:05
whatnext I did look through the docs, including the page you mentioned - but it was a bit overwhelming tbh '=D 17:06
lizmat yes, it can be :-)
whatnext I wasn't even sure whether it was "middleware" that I wanted
never mind, I will continue to research it 17:07
thanks :) 17:08
jnthnwrthngtn Potentially can use `around` (see the router docs) and use a dynamic variable (like $*DB) 19:08
(Perhaps you have reasons, but setting up a connection every request sounds costly. I think DB::Pg maintains a connection pool.) 19:09
19:32 whatnext left