27 lines
583 B
Rust
27 lines
583 B
Rust
mod app_state;
|
|
mod config;
|
|
mod consts;
|
|
mod database;
|
|
mod errors;
|
|
mod server;
|
|
|
|
use anyhow::{Context, Result};
|
|
use app_state::AppState;
|
|
use errors::{init_error, SyncServerError};
|
|
use server::create_server;
|
|
use std::sync::Arc;
|
|
|
|
#[tokio::main]
|
|
async fn main() -> Result<(), SyncServerError> {
|
|
tracing_subscriber::fmt::init();
|
|
|
|
let app_state = AppState::try_new()
|
|
.await
|
|
.context("Failed to initialise app state")
|
|
.map_err(init_error)?;
|
|
|
|
create_server(app_state)
|
|
.await
|
|
.context("Failed to start server")
|
|
.map_err(init_error)
|
|
}
|