Fix typos, add some code

This commit is contained in:
Marko Korhonen 2020-05-09 12:05:12 +03:00
parent 83da9d31cc
commit 6fc4750cdc
No known key found for this signature in database
GPG key ID: 911B85FBC6003FE5
15 changed files with 155 additions and 78 deletions

View file

@ -52,6 +52,7 @@ async fn api_404_unconfigured() -> HttpResponse {
HttpResponse::NotFound().finish()
}
#[rustfmt::skip]
#[actix_rt::main]
async fn main() -> std::io::Result<()> {
std::env::set_var("RUST_LOG", "actix_web=debug,diesel=debug");
@ -91,14 +92,41 @@ async fn main() -> std::io::Result<()> {
.service(api_404)
.service(
scope("/api/auth")
.service(resource("/register").route(post().to(authentication::register)))
.service(resource("/login").route(post().to(authentication::login)))
.service(resource("/logout").route(post().to(authentication::logout)))
.service(resource("/delete").route(delete().to(authentication::delete))),
.service(
resource("/register")
.route(post()
.to(authentication::register)
)
)
.service(
resource("/login")
.route(post()
.to(authentication::login)
)
)
.service(
resource("/logout")
.route(post()
.to(authentication::logout)
))
.service(
resource("/delete")
.route(delete()
.to(authentication::delete)
)
)
)
.service(
resource("/api/protected")
.route(get()
.to(protected::protected_route)
)
)
.service(resource("/api/protected").route(get().to(protected::protected_route)))
.service(api_404_unconfigured)
.service(Files::new("/", "./static").index_file("index.html"))
.service(
Files::new("/", "./static")
.index_file("index.html")
)
.default_service(get().to(serve_index_html))
})
.bind(address)?