Putting it together
We have covered a lot in order to get some basic views up and running on an Actix Web server. We could have done this all on one page:
use actix_web::{web, App, HttpRequest, HttpServer, Responder};
pub async fn logout() -> String {
format!("Logout view")}
pub async fn login() -> String {
format!("Login view")}
#[actix_rt::main]
async fn main() -> std::io::Result<()> {
HttpServer::new(|| {
let app = App::new()
.route("/auth/login", web::get().to(login))
.route("/auth/logout", web::get().to(logout));
return app
})
.bind("127...