Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #[macro_use]
- extern crate rouille;
- use rouille::Response;
- use std::sync::Mutex;
- struct GlobalAuthData {
- session_id: String
- }
- fn main() {
- let global_state: Mutex<Option<GlobalAuthData>> = Mutex::new(None);
- rouille::start_server("0.0.0.0:5000", move |request| {
- let response = router!(request,
- (GET) (/) => {
- let v = GlobalAuthData { session_id: String::from("test") };
- // assign value of v to "global_state"
- Response::text("auth_url")
- },
- _ => {
- Response::empty_404()
- }
- );
- response
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement