Use App::configure to set up actix

This avoids the need for the messy cache-control-header macro.
Otherwise, it has no effect.
This commit is contained in:
Dustin J. Mitchell
2021-10-09 17:53:36 -04:00
parent f109056340
commit aaac1c3356
7 changed files with 63 additions and 40 deletions

View File

@@ -7,7 +7,7 @@ use taskchampion_sync_server::{storage::InMemoryStorage, Server};
async fn cross_sync() -> anyhow::Result<()> {
let server = Server::new(Box::new(InMemoryStorage::new()));
let httpserver =
HttpServer::new(move || App::new().service(server.service())).bind("0.0.0.0:0")?;
HttpServer::new(move || App::new().configure(|sc| server.config(sc))).bind("0.0.0.0:0")?;
// bind was to :0, so the kernel will have selected an unused port
let port = httpserver.addrs()[0].port();