improve and move around tests, make the API part of it function

This commit is contained in:
askiiart 2024-11-25 22:23:05 -06:00
parent 1beab57613
commit 85a876b221
Signed by untrusted user who does not match committer: askiiart
GPG key ID: EA85979611654C30
5 changed files with 152 additions and 106 deletions

View file

@ -20,11 +20,25 @@
pub mod api;
pub mod data;
mod dummy;
use rocket::{self};
/// Runs the server
pub fn run(conf: data::Config, caps: data::Caps) -> Result<bool, String> {
rocket::build().mount("/", rocket::routes![]).launch();
return Ok(true);
pub async fn run(conf: data::Config) -> Result<bool, rocket::Error> {
unsafe {
api::CONFIG = Some(conf);
}
match rocket::build()
.mount("/", rocket::routes![api::caps])
.launch()
.await
{
Ok(_) => {
return Ok(true);
}
Err(e) => {
return Err(e);
}
}
}