The Recipe API is a Node.js application built using Express.js and MongoDB. It provides endpoints to manage recipes, including creating, reading, updating, and deleting recipe data.
- Create Recipe: Add new recipes with ingredients and instructions.
- Read Recipe: Retrieve detailed information about recipes.
- Update Recipe: Modify existing recipes.
- Delete Recipe: Remove recipes from the database.
- Node.js (v14 or higher)
- npm
- MongoDB
- Clone the repository:
git clone https://github.com/yourusername/recipe-api.git cd recipe-api
- Install dependencies:
npm install
- Set up environmental variables:
Create a
.env
file in the root directory and add your MongoDB connection string.
- Start the server:
npm start
- Access the API: This application is backend only, and API endpoints can be consumed with HTTP request tools such as Postman
- src/
- controllers/: Contains the logic for handling requests and responses.
- models/: Defines the schema for the Recipe model.
- routes/: Defines the API endpoints.
- app.js: Initializes the Express app and middleware.
- server.js: Starts the server.
- GET /recipes: Retrieve all recipes.
- GET /recipes/:id: Retrieve a specific recipe by ID.
- POST /recipes: Create a new recipe.
- PUT /recipes/:id: Update an existing recipe by ID.
- DELETE /recipes/:id: Delete a recipe by ID.