formats code
This commit is contained in:
@@ -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"))
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user