Add home route

This commit is contained in:
Pierre HUBERT 2022-04-04 17:43:53 +02:00
parent e1eb64f27c
commit f21e40d804

View File

@ -1,6 +1,6 @@
use actix::Actor;
use actix_identity::{CookieIdentityPolicy, IdentityService};
use actix_web::{App, get, HttpServer, web};
use actix_web::{App, get, HttpResponse, HttpServer, web};
use actix_web::cookie::SameSite;
use actix_web::cookie::time::Duration;
use actix_web::middleware::Logger;
@ -87,6 +87,10 @@ async fn main() -> std::io::Result<()> {
.wrap(AuthMiddleware {})
.wrap(IdentityService::new(policy))
// main route
.route("/", web::get()
.to(|| async { HttpResponse::Found().append_header(("Location", "/settings")).finish() }))
// health route
.service(health)