Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/craftingweb/recipe-sequalize
https://github.com/craftingweb/recipe-sequalize
Last synced: 3 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/craftingweb/recipe-sequalize
- Owner: craftingweb
- Created: 2023-07-12T19:11:49.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-07-13T12:51:02.000Z (over 1 year ago)
- Last Synced: 2024-06-03T23:24:52.345Z (6 months ago)
- Language: JavaScript
- Size: 28.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Recipe-Sequalize
https://github.com/VitaliPri/Recipe-Sequalize/assets/101225909/062354ee-3619-47f6-85c8-0476c4728811
Installation
1. Clone the repository with HTTP:
git clone https://github.com/VitaliPri/Recipe-Sequalize.git
with SSH key:
git clone [email protected]:VitaliPri/Recipe-Sequalize.git3. Install the dependencies:
cd recipe-app
npm install
4. Database Configuration:
Set up a PostgreSQL database.
Configure the database connection by updating the config/config.js file with your database credentials.5. Running the Application
To start the application, run the following command:
npm start
The server will start running on http://localhost:4000API Endpoints
Get All Recipes
Endpoint: GET /recipes
Description: Retrieves a list of all recipes.
Response:
Status Code: 200 (OK)
Body: Array of recipe objects
------------------------------------------------
Get Recipe by IDEndpoint: GET /recipes/:id
Description: Retrieves a specific recipe by ID.
Parameters:
id (string): The ID of the recipe.
Response:
Status Code: 200 (OK)
Body: Recipe object
-------------------------------------------------
Create RecipeEndpoint: POST /recipes
Description: Creates a new recipe.
Request Body:
title (string): The title of the recipe.
description (string): The description of the recipe.
ingredients (string): The ingredients of the recipe.
instructions (string): The instructions for the recipe.
Response:
Status Code: 201 (Created)
Body: Created recipe object
--------------------------------------------------
Update RecipeEndpoint: PUT /recipes/:id
Description: Updates an existing recipe.
Parameters:
id (string): The ID of the recipe to update.
Request Body:
title (string): The updated title of the recipe.
description (string): The updated description of the recipe.
ingredients (string): The updated ingredients of the recipe.
instructions (string): The updated instructions for the recipe.
Response:
Status Code: 200 (OK)
Body: Updated recipe object
---------------------------------------------------
Delete RecipeEndpoint: DELETE /recipes/:id
Description: Deletes a recipe.
Parameters:
id (string): The ID of the recipe to delete.
Response:
Status Code: 204 (No Content)#Validation
Server-side data validation is implemented using Sequelize's built-in validation methods. The following fields have specific validation rules:title: Required, minimum length of 3 characters.
description: Required, maximum length of 500 characters.
ingredients: Required, maximum length of 1000 characters.
instructions: Required, maximum length of 5000 characters.#Error Handling
The application handles errors and provides appropriate error messages for invalid requests or database errors. When an error occurs, the server responds with the appropriate status code and an error message in the response body.Contributing
Contributions are welcome! If you find any issues or want to enhance the application, please submit a pull request.