Look at demo here: http://cookbook-express-api.herokuapp.com
method: GET
endpoint: https://cookbook-express-api.herokuapp.com/api/recipes/
https://cookbook-express-api.herokuapp.com/api/recipes/:page?/:quantity?
return: {
500: "internal error",
200: "list of recipes with id and name"
}
method: GET
endpoint: https://cookbook-express-api.herokuapp.com/api/recipe/:id
return: {
500: "internal error",
200: "the requested recipe of id",
204: "recipe not found"
}
method: POST
endpoint: https://cookbook-express-api.herokuapp.com/api/recipe/
sample payload: {
"nome": "Brownie de Chocolate com Gengibre",
"secao": [
{
"nome": " Ingredientes",
"conteudo": [
"50 g farinha de milho fina",
"10 g de cacau em pó"
]
},
{
"nome": " Modo de Preparo",
"conteudo": [
"1 - Coloque numa tigela a farinha de milho fina e o cacau em pó.",
"2 - Misture e reserve."
]
},
{
"nome": " Outras informações",
"conteudo": [
"Rendimento: 20 porções "
]
}
]
}
return: {
500: "internal error",
200: {inserted: true},
204: {inserted: false}
}
method: PUT
endpoit: https://cookbook-express-api.herokuapp.com/api/recipe
sample payload: {
"_id": "5744eff20ca7832b5c745abf",
"nome": "abc2",
"secao": [{
"nome": " Ingredientes",
"conteudo": [
"123"
]
}, {
"nome": " Modo de Preparo",
"conteudo": [
"456"
]
}, {
"nome": " Outras informações",
"conteudo": [
"789"
]
}]
}
return: {
500: "internal error",
200: {updated: true},
204: {updated: false}
}
method: DELETE
endpoit: https://cookbook-express-api.herokuapp.com/api/recipe/:id
return: {
500: "internal error",
200: {removed: true},
204: {removed: false}
}