The Food API provides three endpoints for managing the restaurant’s menu. These are used by both the admin dashboard (to add/remove items) and the customer frontend (to list items). Image files are handled automatically by Multer and stored on the server’s local filesystem underDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/bhavnesh7781/Food-Delivery-App/llms.txt
Use this file to discover all available pages before exploring further.
backend/uploads/.
POST /api/food/add
Adds a new food item to the menu. This is amultipart/form-data request because it includes an image file upload. Multer stores the image in the uploads/ directory using the filename pattern <timestamp><originalname> — only the resulting filename (not the full path) is saved in MongoDB.
This endpoint does not require authentication in the current implementation. Restrict access to admin roles before deploying to production.
multipart/form-data
Request Body
The display name of the food item (e.g.,
"Caesar Salad").A short description of the food item shown on the menu card.
Price of the item in INR (e.g.,
199).Menu category the item belongs to. Must be one of:
Salad, Rolls, Deserts, Sandwich, Cake, Pure Veg, Pasta, Noodles.The food item image file. Accepted via the
image form field. Stored in backend/uploads/ as <timestamp><originalname> (e.g., 1716300000000burger.png).Response
true when the item was saved successfully, false on error."Food Added" on success, "Error" on failure.Example
GET /api/food/list
Returns all food items currently in the database. This is the primary data source for the customer-facing menu page. No request parameters are required.Food item images are not embedded in the response. The
image field contains only the stored filename (e.g., "1716300000000caesar.jpg"). Serve the actual image by appending the filename to the /images/ route: GET /images/<filename>.Response
true when the list was fetched successfully.Array of all food item documents from MongoDB.
Example
POST /api/food/remove
Removes a food item from the menu by its MongoDB_id. The controller first resolves the item’s stored image filename, deletes the file from the uploads/ directory on disk using fs.unlink, and then removes the document from MongoDB.
This endpoint does not require authentication in the current implementation. Restrict access to admin roles before deploying to production.
Request Body
The MongoDB
_id of the food item to remove (e.g., "6641a3f2e4b0c123456789ab").Response
true when the item and its image were removed successfully."Food Removed" on success, "Error" on failure.