improve and move around tests, make the API part of it function
This commit is contained in:
parent
1beab57613
commit
85a876b221
5 changed files with 152 additions and 106 deletions
20
src/lib.rs
20
src/lib.rs
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue