On Tue, 2015-08-25 at 15:20 +0100, Dancer New wrote: > > > The problem I have now was the database connection in 'before hook' ( > > > setting user context) and the db connection in the route for actual query > > > seems two different db connections. So the database doesn't know they are > > > from the same user request and therefore doesn't return the right results. > > > > It sounds like you are initiating a new database connection for each page > > request? If so, that's very expensive, and not likely to be very scalable. > > > > I would like to know how to make one db connection and use it in all > requests. where to store the database handler?
You could try this: https://metacpan.org/pod/Dancer2::Plugin::Database That's not going to work if you need a different database connection per user though, in which case you could maybe store the connection handle in the user's session. Andy _______________________________________________ dancer-users mailing list [email protected] http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
