Created
October 31, 2020 17:40
-
-
Save rtsuk/8afec697926682bb4b2908c7ca826d53 to your computer and use it in GitHub Desktop.
Rust main for web app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[async_std::main] | |
async fn main() -> tide::Result<()> { | |
tide::log::start(); | |
let mut app = tide::new(); | |
app.with(tide::sessions::SessionMiddleware::new( | |
tide::sessions::MemoryStore::new(), | |
b"Raz is ready to play anytime, anywhere, aroo aroo", | |
)); | |
app.at("/").get(|req| show_call_list(req)); | |
app.at("/block_number/:number").get(|req| block_number(req)); | |
app.at("/unblock_number/:number") | |
.get(|req| unblock_number(req)); | |
app.at("/block_name/:name").get(|req| block_name(req)); | |
app.at("/unblock_name/:name").get(|req| unblock_name(req)); | |
app.at("/allow_number/:number").get(|req| allow_number(req)); | |
app.at("/unallow_number/:number") | |
.get(|req| unallow_number(req)); | |
app.at("/blocked").get(|_| show_blocked_list()); | |
app.at("/allowed").get(|_| show_allowed_list()); | |
app.listen("0.0.0.0:8080").await?; | |
Ok(()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment