formats code

This commit is contained in:
2019-07-20 15:00:28 +02:00
parent 0636829fdd
commit 51a3d00d03
5 changed files with 106 additions and 62 deletions

View File

@@ -65,8 +65,18 @@ pub(crate) fn serve() -> std::io::Result<()> {
)
.service(
web::scope("/api")
.route("/players", web::get().to_async(move |pool: AppPool| db_call(pool, move |api| api.fetch_players())))
.route("/claims", web::get().to_async(move |pool: AppPool| db_call(pool, move |api| api.fetch_claims())))
.route(
"/players",
web::get().to_async(move |pool: AppPool| {
db_call(pool, move |api| api.fetch_players())
}),
)
.route(
"/claims",
web::get().to_async(move |pool: AppPool| {
db_call(pool, move |api| api.fetch_claims())
}),
)
.route(
"/{player_id}/update-wealth/{amount}",
web::get().to_async(move |pool: AppPool, data: web::Path<(i32, f32)>| {
@@ -99,12 +109,14 @@ pub(crate) fn serve() -> std::io::Result<()> {
)
.route(
"/admin/add-player/{name}/{wealth}",
web::get().to_async(move |pool: AppPool, data: web::Path<(String, f32)>| {
db_call(pool, move |api| {
api.as_admin().add_player(data.0.clone(), data.1)
})
}),
)
web::get().to_async(
move |pool: AppPool, data: web::Path<(String, f32)>| {
db_call(pool, move |api| {
api.as_admin().add_player(data.0.clone(), data.1)
})
},
),
),
)
.service(fs::Files::new("/", www_root.clone()).index_file("index.html"))
})