Salvo and sessions? #129
Unanswered
jhjacobs81
asked this question in
Q&A
Replies: 2 comments 5 replies
-
Try code like this: use salvo::extra::session::SessionDepotExt;
#[handler]
async fn my_page(depot: &mut Deport) {
let session = depot.session();
} |
Beta Was this translation helpful? Give feedback.
1 reply
-
so i have this:
but this returns an error, because session.insert(..) expects 1 argument and i supplied 2. that makes no sense.. what use is a session if i cant add data to it? if i uncomment the session.insert line, it prints "None" which i assume is correct since i havent created a new session, so there is nothing to show? i also assume thats why session.insert doesnt work? but how would i go about that? how do i create a session in the depot so that it sticks across requests? |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello!
I am trying to build a webapp where one needs to login. so i want to use sessions, and i wonder if anyone had any luck with that?
i came across: https://docs.rs/async-session/latest/async_session/
i can get the example to work, i can initialize a session, put the userid in it. when i print the raw session data i get:
So i can safely assume this part of the login process works :-) But i have no clue about how i would get this to the next page? This could very well be due to me beeing very new at rust, so hopefully someone more experienced can have a look and point me in the right direction?
Beta Was this translation helpful? Give feedback.
All reactions