Skip to content

mirkostanic/recipes-backend

Repository files navigation

recipes-backend

REST API for accessing recipes database.

To install run the following commands in the root directory:
./docker-compose build
./docker-compose up

If Docker is not available, run npm start from the root directory.
Note: Make sure you have MongoDB installed and listening on port 27017 in this case.

The api is exposed on localhost:8080/api/

API Methods

POST recipe/search/:title
Search for the recipe with the title of :title.

POST recipe/create
Create recipe. Method expects you to pass a JSON object containing title, description, ingredients and direction.
Example input: {"title":"Some cake", "description":"Cakey cake.", "ingredients":"2kg of cake stuff.", "directions":"Bake for 4 hours."}

GET recipe/read/:id
Read the recipe with the id of :id.

PUT recipe/update/:id
Update the recipe with the id of :id. Method expects you to pass a JSON object containing title, description, ingredients and direction.
Example input: {"title":"Some new cake", "description":"Cakey cake.", "ingredients":"2kg of cake stuff.", "directions":"Bake for 4 hours."}

DELETE recipe/delete/:id
Delete the recipe with the id of :id.

POST interaction/like/:id
Add a like to the recipe with the id of :id. Method expects you to pass a JSON object containing type and value.
Example input: {"type":"rate", "value":"+"}

POST interaction/comment/:id
Add a comment to the recipe with the id of :id. Method expects you to pass a JSON object containing type and value.
Example input: {"type":"comment", "value":"Nice cake."}

POST interaction/rate/:id
Add a rating to the recipe with the id of :id. Method expects you to pass a JSON object containing type and value.
Example input: {"type":"rate", "value":"4"}

About

REST API for accessing recipes database.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published