use actix_web::dev::Server;
use crate::server::startup;
pub struct Application {
pub server: Server,
}
impl Application {
pub async fn run<F>(server_name: &'static str, cfg: F)
where
F: Fn(&mut actix_web::web::ServiceConfig, actix_web::web::Data<crate::server::AppContext>)
+ Send
+ Clone
+ 'static,
{
let app_context = crate::server::AppContext::build(server_name).await;
match startup::run(app_context, server_name, cfg).await {
Ok(_) => {}
Err(err) => {
log::error!("error={:?}", err);
}
};
}
}