Skip to content

Commit a741b0a

Browse files
committed
refactor: Change code to load library
1 parent 1b6bb50 commit a741b0a

File tree

1 file changed

+6
-26
lines changed

1 file changed

+6
-26
lines changed

src/main.rs

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,9 @@
1-
#[macro_use]
2-
extern crate rocket;
1+
use bibimbap_backend::run;
32

4-
#[get("/health_check")]
5-
fn health_check() {
6-
()
7-
}
8-
9-
#[launch]
10-
fn rocket() -> _ {
11-
rocket::build().mount("/", routes![health_check])
12-
}
13-
14-
#[cfg(test)]
15-
mod test {
16-
use super::rocket;
17-
use rocket::http::Status;
18-
use rocket::local::blocking::Client;
19-
use std::io::Read;
20-
21-
#[test]
22-
fn health_check_works() {
23-
let client = Client::tracked(rocket()).expect("Failed to create client");
24-
let response = client.get(uri!(super::health_check)).dispatch();
25-
26-
assert_eq!(response.status(), Status::Ok);
27-
assert_eq!(response.bytes().count(), 0);
3+
#[rocket::main]
4+
async fn main() {
5+
if let Err(e) = run().launch().await {
6+
println!("Failed to launch Rocket: {e}");
7+
drop(e);
288
}
299
}

0 commit comments

Comments
 (0)