Adds simple delete api

This commit is contained in:
2019-02-02 15:56:44 +01:00
parent 46532eee9e
commit a7cc92f903
6 changed files with 32 additions and 3 deletions

View File

@@ -55,11 +55,18 @@ mod api {
.collect()
)
}
#[get("/delete/<id>")]
pub fn delete_recipe(conn: CookbookDbConn, id: i32) -> Json<bool> {
Json(
recipes::delete(&conn, id)
)
}
}
fn main() {
rocket::ignite()
.attach(api::CookbookDbConn::fairing())
.mount("/", routes![index])
.mount("/api", routes![api::recipes_list]).launch();
.mount("/api", routes![api::recipes_list, api::delete_recipe]).launch();
}