Fix no main found
This commit is contained in:
parent
2d1d5b66a9
commit
968dcbdb56
1 changed files with 10 additions and 4 deletions
14
src/main.rs
14
src/main.rs
|
@ -18,9 +18,9 @@ async fn run_migrations(rocket: Rocket<Build>) -> Rocket<Build> {
|
||||||
rocket
|
rocket
|
||||||
}
|
}
|
||||||
|
|
||||||
#[launch]
|
#[rocket::main]
|
||||||
fn rocket() -> _ {
|
async fn main() {
|
||||||
rocket::build()
|
let rocket_builder = rocket::build()
|
||||||
.mount("/", routes![
|
.mount("/", routes![
|
||||||
controllers::tasks_controller::index_template
|
controllers::tasks_controller::index_template
|
||||||
])
|
])
|
||||||
|
@ -37,5 +37,11 @@ fn rocket() -> _ {
|
||||||
])
|
])
|
||||||
.attach(DbConn::fairing())
|
.attach(DbConn::fairing())
|
||||||
.attach(Template::fairing())
|
.attach(Template::fairing())
|
||||||
.attach(AdHoc::on_ignite("Run Migrations", run_migrations))
|
.attach(AdHoc::on_ignite("Run Migrations", run_migrations));
|
||||||
|
|
||||||
|
if let Err(e) = rocket_builder.launch().await {
|
||||||
|
println!("Whoops! Rocket didn't launch!");
|
||||||
|
// We drop the error to get a Rocket-formatted panic.
|
||||||
|
drop(e);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue