Fix typos, add some code
This commit is contained in:
parent
83da9d31cc
commit
6fc4750cdc
15 changed files with 155 additions and 78 deletions
|
@ -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)?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue