refactor sync server into modules

This commit is contained in:
Dustin J. Mitchell
2020-11-25 23:16:05 -05:00
parent d0bfbbb7f0
commit 087333a227
9 changed files with 1504 additions and 102 deletions

24
sync-server/src/main.rs Normal file
View File

@@ -0,0 +1,24 @@
use actix_web::{App, HttpServer};
use server::SyncServer;
use std::sync::Arc;
mod api;
mod server;
mod types;
// TODO: use hawk to sign requests
#[actix_web::main]
async fn main() -> std::io::Result<()> {
let sync_server = Arc::new(SyncServer::new());
HttpServer::new(move || {
App::new()
.data(sync_server.clone())
.service(api::get_child_version::service)
.service(api::add_version::service)
})
.bind("127.0.0.1:8080")?
.run()
.await
}