Improve error handling

This commit is contained in:
2023-05-07 18:20:19 -04:00
parent c2c0f7a28d
commit de157a3b1e
7 changed files with 293 additions and 32 deletions

View File

@@ -27,9 +27,9 @@ async fn main() -> anyhow::Result<()> {
sqlx::migrate!().run(&pool).await?;
let app = Router::new()
.route("/items", get(handlers::items::get))
.route("/item", post(handlers::item::post))
.route("/item/:id", get(handlers::item::get))
.route("/v1/items", get(handlers::items::get))
.route("/v1/item", post(handlers::item::post))
.route("/v1/item/:id", get(handlers::item::get))
.with_state(pool)
.layer(ServiceBuilder::new().layer(TraceLayer::new_for_http()));