#Deployed Backend url https://mealplanner-backend-8v3d.onrender.com
Purpose: Creates a new user account.
name
(string): The user's name.email
(string): The user's email address.password
(string): The user's password.
- Status 201 (Created):
{"msg": "User created successfully"}
- Status 400 (Bad Request):
{"msg": "User already exists"}
- Status 500 (Internal Server Error):
{"msg": "error message"}
Purpose: Logs in an existing user.
email
(string): The user's email address.password
(string): The user's password.
- Status 200 (OK):
{"token": "..."}
- Status 404 (Not Found):
{"msg": "User does not exist"}
- Status 400 (Bad Request):
{"msg": "Invalid password"}
- Status 500 (Internal Server Error):
{"msg": "error message"}
Purpose: Retrieves all recipes.
- Status 200 (OK): A JSON array of all recipes.
- Status 500 (Internal Server Error):
{"message": "Failed to fetch recipes", "error": "error details"}
Purpose: Search recipes by name.
name
(string): The recipe name to be searched.
- Status 200 (OK): A JSON array of matched recipes.
- Status 500 (Internal Server Error):
{"message": "Failed to fetch recipes", "error": "error details"}
Purpose: Filter recipes by meal type and dietary preference.
mealType
(string): Meal type.dietaryPreference
(string): Dietary preference.
- Status 200 (OK): A JSON array of matched recipes.
- Status 500 (Internal Server Error):
{"message": "Failed to fetch recipes", "error": "error details"}
Purpose: Sort recipes by calories in ascending (ASC) or descending (DESC) order.
sortOrder
(string): Sort order (ASC or DESC).
- Status 200 (OK): A JSON array of sorted recipes.
- Status 500 (Internal Server Error):
{"message": "Failed to fetch recipes", "error": "error details"}
- All routes should be prefixed with the
/api
endpoint. For example, to access theregister
route, call/api/register
. - All routes use JSON for request and response payloads.
- All routes require an authentication token sent in the
Authorization
header.