A Rust CRUD app for storing recipes, with Axum and Sqlx. Heavily borrowed from https://github.com/davidpdrsn/realworld-axum-sqlx.
GET
/api/recipes
name | type | data type | description |
---|---|---|---|
ingredient_name_ids | optional | Integer Array | list of ids of ingredient names to filter recipes by. If not provided, all recipes will be returned |
http code | content-type | response |
---|---|---|
200 |
application/json |
{"recipes": [{id, title, description}..]} |
POST
/api/recipes
name | type | data type | description |
---|---|---|---|
title | required | String | Title for new recipe |
description | required | String | description for new recipe |
ingredients | optional | Array of {int,int,int} | array of RecipeIngredientDto objects with format: {id_ingredient_name: integer, id_ingredient_quantity: integer, id_ingredient_unit: integer} |
http code | content-type | response |
---|---|---|
200 |
application/json |
{id, title, description, ingredients: [{id_ingredient_name, id_ingredient_quantity, id_ingredient_unit}..]} |
GET
/api/recipes/:recipe_id
http code | content-type | response |
---|---|---|
200 |
application/json |
{id, title, description, ingredients: [{id_ingredient_name, id_ingredient_quantity, id_ingredient_unit}..]} |
PUT
/api/recipes/:recipe_id
name | type | data type | description |
---|---|---|---|
title | required | String | new title for recipe |
description | required | String | new description for recipe |
ingredients | required | Array of {int,int,int} | array of RecipeIngredientDto objects with format: {id_ingredient_name: integer, id_ingredient_quantity: integer, id_ingredient_unit: integer} |
http code | content-type | response |
---|---|---|
200 |
application/json |
{id, title, description, ingredients: [{id_ingredient_name, id_ingredient_quantity, id_ingredient_unit}..]} |
GET
/api/ingredients/names
http code | content-type | response |
---|---|---|
200 |
application/json |
{"names": [{id, name}..]} |
POST
/api/ingredients/names
name | type | data type | description |
---|---|---|---|
name | required | String | new ingredient name |
http code | content-type | response |
---|---|---|
200 |
application/json |
{"id": integer, "name": string} |
GET
/api/ingredients/quantities
http code | content-type | response |
---|---|---|
200 |
application/json |
{"quantities": [{id, quantity}..]} |
POST
/api/ingredients/quantities
name | type | data type | description |
---|---|---|---|
quantity | required | String | new ingredient quantity |
http code | content-type | response |
---|---|---|
200 |
application/json |
{"id": integer, "quantity": string} |
GET
/api/ingredients/units
http code | content-type | response |
---|---|---|
200 |
application/json |
{"units": [{id, unit}..]} |
POST
/api/ingredients/units
name | type | data type | description |
---|---|---|---|
unit | required | String | new ingredient unit |
truncation | required | String | new ingredient unit truncation |
http code | content-type | response |
---|---|---|
200 |
application/json |
{"id": integer, "unit": string, "truncation": string} |