The Cocktail Recipes API is a RESTful API that allows users to explore, create, update, and delete cocktail recipes.
📖 Retrieve a list of all cocktails or a specific recipe.
➕ Create a new cocktail recipe.
✏️ Update existing cocktail recipes.
❌ Delete a recipe from the database.
🔍 Search for cocktails by name or ingredients.
Backend: Node.js, Express.js
Tools: Postman
GET /cocktailsResponse:
[
{
"id": 1,
"name": "Mojito",
"ingredients": ["White Rum", "Sugar", "Lime", "Soda Water", "Mint"],
"instructions": "Muddle mint leaves with sugar and lime juice, add rum, and top with soda water."
}
]GET /cocktails/:idResponse:
{
"id": 1,
"name": "Mojito",
"ingredients": ["White Rum", "Sugar", "Lime", "Soda Water", "Mint"],
"instructions": "Muddle mint leaves with sugar and lime juice, add rum, and top with soda water."
}GET /api/cocktails/filter?key={attribute}&value={value}Example Request:
GET /api/cocktails/filter?key=ingredients&value=VodkaResponse:
[
{
"id": 2,
"name": "Espresso Martini",
"category": "Cocktail",
"ingredients": ["Vodka", "Coffee Liqueur", "Espresso", "Sugar Syrup"],
"instructions": "Shake all ingredients with ice and strain into a martini glass."
}
]POST /cocktailsRequest Body:
{
"name": "Margarita",
"ingredients": ["Tequila", "Triple Sec", "Lime Juice", "Salt"],
"instructions": "Shake all ingredients with ice and strain into a salt-rimmed glass."
}PUT /cocktails/:idRequest Body:
{
"name": "Updated Margarita",
"ingredients": ["Tequila", "Triple Sec", "Lime Juice", "Salt"],
"instructions": "Blend with ice for a frozen margarita."
}DELETE /cocktails/:idResponse:
{
"message": "Cocktail deleted successfully."
}git clone https://github.com/your-username/cocktail-recipes-api.git
cd cocktail-recipes-apinpm installnpm startThe API will be available at http://localhost:3000.
🍸 Create a front-end to display the cocktails
📂 Add recipes to a database for better storage and scalability
✅ Authentication & authorization
📦 Migrate from JSON storage to a database (MongoDB, PostgreSQL, etc.)
🌍 Deploy the API for public access
Feel free to fork, create issues, and submit pull requests to improve the project!