This commit is contained in:
2022-12-04 15:02:07 +01:00
commit 3b06a130b2
6 changed files with 1748 additions and 0 deletions

22
src/main.rs Normal file
View File

@@ -0,0 +1,22 @@
mod mdstat_parser;
#[macro_use]
extern crate rocket;
use rocket::serde::json::Json;
use crate::mdstat_parser::{MdRaidSystem, parse_mdstat};
#[get("/raiddevices")]
fn get_raid_devices() -> Json<MdRaidSystem> {
Json(parse_mdstat())
}
#[rocket::main]
async fn main() -> Result<(), rocket::Error> {
let _rocket = rocket::build()
.mount("/api", routes![get_raid_devices])
.launch()
.await?;
Ok(())
}