You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Simple and rustic example of nodejs using express framework.
cookbook-express-api
get list recipes
method: GET
endpoint: http://running.com/api/recipes/
http://running.com/api/recipes/:page?/:quantity?return: {500: "internal error",200: "list of recipes with id and name"}
get by recipe by id
method: GET
endpoint: http://running.com/api/recipe/:idreturn: {500: "internal error",200: "the requested recipe of id",204: "recipe not found"}
insert new recipe
method: POST
endpoint: http://running.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}}
find and modify recipe
method: PUT
endpoit: http://running.com/api/recipesample 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}}