Mealbox Server is a backend application designed to manage meal-related data and provide RESTful APIs for a meal delivery or management system. This server handles user authentication, meal management, order processing, and more. It is built using Node.js and Express, and connects to a database (e.g., MongoDB) to store and retrieve data.
- User registration and authentication
- Meal listing and management (CRUD operations)
- Order placement and tracking
- Secure API endpoints
- Error handling and validation
-
User Authentication:
Users can register and log in. Authentication tokens (JWT) are used to secure protected routes. -
Profile Management:
Register User can update there information and addresses. -
Meal Management:
Meal Provider can add, update, or delete meals. Users can view available meals. -
Order Processing:
Authenticated users can place orders for meals. Orders are stored and can be tracked. -
API Endpoints:
The server exposes RESTful endpoints for all operations. Middleware ensures security and data validation. -
Database Integration:
All data (users, meals, orders) is stored in a database. Models define the structure and relationships.
-
Clone the repository:
git clone https://github.com/yourusername/mealbox-server.git cd mealbox-server -
Install dependencies:
npm install
-
Configure environment variables:
Create a.envfile with your database URI, JWT secret, and other settings. -
Run the server:
npm run dev
| Route | Description |
|---|---|
POST /api/users/create-user |
Register a new user |
GET /api/get-user/:email |
Get the spesific User |
PUT /api/update-user/:email |
To update the user info |
POST /api/auth/sign-in |
User login |
POST /api/create-meal |
Create Meal (Meal Provider only) |
GET /api/meals |
Get All the meals |
PUT /api/update-meal/:id |
Update Meal (Meal Provider only) |
POST /api/order-meal |
Order meal (Customer only) |
GET /api/get-orders/:email |
Get ordered Meals |
PUT /api/order-status/:id |
Update order |
GET /api/create-preference |
Create preference (Customer only) |
GET /api/get-preference/:email |
Get Preference |
PUT /api/update-preference/:email |
Update Preference (Customer only) |