cryptgeon/backend/src/main.rs

31 lines
645 B
Rust
Raw Normal View History

2022-03-05 11:47:11 +00:00
use actix_web::{middleware, web, App, HttpServer};
2021-12-20 23:15:04 +00:00
use dotenv::dotenv;
2021-05-01 10:39:40 +00:00
#[macro_use]
extern crate lazy_static;
2022-02-28 23:53:47 +00:00
mod api;
2021-05-02 10:32:03 +00:00
mod client;
mod config;
2021-05-01 10:39:40 +00:00
mod note;
2021-12-20 16:42:16 +00:00
mod size;
mod status;
2021-05-02 10:32:03 +00:00
mod store;
2021-05-01 10:39:40 +00:00
#[actix_web::main]
async fn main() -> std::io::Result<()> {
2021-12-20 23:15:04 +00:00
dotenv().ok();
2021-12-20 16:42:16 +00:00
return HttpServer::new(|| {
2021-05-01 10:39:40 +00:00
App::new()
.wrap(middleware::Compress::default())
.wrap(middleware::DefaultHeaders::default())
2021-12-20 16:42:16 +00:00
.configure(size::init)
2022-02-28 23:53:47 +00:00
.configure(api::init)
2021-05-02 10:32:03 +00:00
.configure(client::init)
2022-03-05 11:47:11 +00:00
.default_service(web::to(client::index))
2021-05-01 10:39:40 +00:00
})
2021-05-02 11:53:48 +00:00
.bind("0.0.0.0:5000")?
2021-05-01 10:39:40 +00:00
.run()
2021-12-20 16:42:16 +00:00
.await;
2021-05-01 10:39:40 +00:00
}