Update schema, add status endpoint

This commit is contained in:
2020-09-07 16:51:01 -04:00
parent 170a3a8b02
commit 8d5fe7f75d
13 changed files with 249 additions and 246 deletions

View File

@@ -73,16 +73,16 @@ async fn main() -> Result<()> {
let host = env::var("HOST").expect("`HOST` environment variable not defined");
let host_url = Url::parse(&host).expect("Cannot parse URL from `HOST` environment variable");
let api_url = host_url.join("/api/v1/")?;
let api_url = host_url.join("/v1/")?;
let env = Environment::new(api_url).await?;
let base = warp::path("api").and(warp::path("v1"));
let routes = base
.and(
let base = warp::path("v1");
let routes = filters::status()
.or(base.and(
filters::shops(env.clone())
.or(filters::owners(env.clone()))
.or(filters::interior_ref_lists(env.clone())),
)
))
.recover(problem::unpack_problem)
.with(warp::compression::gzip())
.with(warp::trace::request());
@@ -97,7 +97,7 @@ async fn main() -> Result<()> {
let server = if let Some(l) = listenfd.take_tcp_listener(0)? {
Server::from_tcp(l)?
} else {
Server::bind(&([0, 0, 0, 0], 3030).into())
Server::bind(&([127, 0, 0, 1], 3030).into())
};
// warp::serve(routes).run(([127, 0, 0, 1], 3030)).await;