Skip to content

sidhanta03/culinarycraft-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CulinaryCraft API – Crafting Delicious Recipes with Code

CulinaryCraft API is a backend service designed to manage and share recipes efficiently. Built using Node.js and Express.js, this API allows users to create, retrieve, update, and delete recipes with structured data storage using MongoDB and Mongoose.

Features

  • Create new recipes with detailed attributes.
  • Retrieve all recipes or filter by title, author, or difficulty.
  • Update recipe details like difficulty level, preparation time, and cooking time.
  • Delete recipes securely with error handling.
  • Uses Mongoose for database modeling and schema validation.

Tech Stack

  • Backend: Node.js, Express.js
  • Database: MongoDB (Atlas)
  • ORM: Mongoose

Installation & Setup

Prerequisites

Ensure you have the following installed:

  • Node.js
  • MongoDB (Cloud-based like MongoDB Atlas)
  • Postman (for API testing)

Clone the Repository

git clone https://github.com/sidhanta03/culinarycraft-api.git
cd culinarycraft-api

Install Dependencies

npm install

Set Up Environment Variables

Create a .env file and configure it:

MONGO_URI=your_mongodb_connection_string

Run the Server

npm start

Server will be running at http://localhost:3000

API Endpoints

1. Create a Recipe

POST /recipes

{
  "title": "Spaghetti Carbonara",
  "author": "Sanjeev Kapoor",
  "difficulty": "Intermediate",
  "prepTime": 20,
  "cookTime": 15,
  "ingredients": ["200g spaghetti", "100g pancetta", "2 large eggs"],
  "instructions": ["Cook spaghetti", "Sauté pancetta", "Mix with eggs and cheese"],
  "imageUrl": "https://spaghetti_Carbonara.jpg"
}

Response:

{
  "message": "Recipe created successfully",
  "recipe": {...}
}

2️⃣ Get All Recipes

2. Get All Recipes

GET /recipes

3. Get Recipe by Title

GET /recipes/title/:title

4. Get Recipes by Author

GET /recipes/author/:author

5. Get Recipes by Difficulty Level

GET /recipes/difficulty/easy

6. Update Recipe Difficulty

PATCH /recipes/:id

{
  "difficulty": "Easy"
}

7. Update Prep Time & Cook Time by Title

PATCH /recipes/title/:title

{
  "prepTime": 40,
  "cookTime": 45
}

8. Delete a Recipe

DELETE /recipes/:id

License

This project is open-source and available under the MIT License.


Contributors

For contributions, feel free to fork the repo and open a pull request!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors