Closed gnunicorn closed 6 years ago
your middleware needs to be specific to AppState
impl Middleware<AppState> for AuthMiddleware {}
ah! Thanks heaps, @fafhrd91 ! Still learning this whole impl-part of things. That seem to do the trick. thanks!
@gnunicorn hello, I encountered the same problem and I want to use extensions, have you updated your solution to use extensions
?
I have a middleware that loads the user information for the
Activist
(read "user") being logged in from the database. For that I use the diesel-example-style AppState with the DB-Actor in it. Now with my Middleware:Aside from the issue that I don't actually want to store it on the session (but haven't yet looked into how to use the
extensions
, that will be added later), the problem is that rust doesn't know we are usingAppState
and it thus complains thatdb
doesn't exist onstate
:Is there any way I can use global AppState from within the middleware? What am I missing? (I couldn't find any example combining those two features)