rust - How to use multiple variables in routes with Nickel? -


nickel states can use variables in urls, sounds useful, possible use multiple variables?

something like:

www.example.com/login/:userid?:apikey?:etc  server.get("/start/:userid?:passwd", middleware! { |request|     // format!("this user: {:?} = {:?}",     // request.param("userid"),     // request.param("passwd")     // ); }); 

you need separator. example:

#[macro_use] extern crate nickel;  use nickel::nickel;  fn main() {     let mut server = nickel::new();      server.utilize(router! {         "/start/:userid/:passwd" => |request, _response| {             println!("this user: {:?} = {:?}",                      request.param("userid"),                      request.param("passwd")                     );              "hello world!"         }     });      server.listen("127.0.0.1:6767"); } 

it looks question might expecting passwd sort of query parameter, rather in url, though.

i caution against creating session get, , should using post instead.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -