This project is a backend service for a restaurant web application developed using Node.js. It provides a RESTful API for functionalities such as restaurant discovery, menu browsing, reservations, and order management. The backend also supports secure payment processing and user authentication.
- Restaurant Discovery: API endpoints to search and discover restaurants based on location, cuisine, and other filters.
- Menu Browsing: Endpoints to retrieve menu details for specific restaurants.
- Reservations: API support for booking tables at restaurants.
- Order Management: Endpoints for placing and managing orders.
- User Authentication: Secure user registration and login endpoints.
- Secure Payments: API integration with payment gateways to handle transactions.
- Backend: Node.js
- Database: MongoDB
- API Documentation: Postman
- MongoDB: Utilized for scalable data management, including storage and retrieval of restaurant data, user profiles, and transaction records.
- Node.js (v14.x or higher)
- MongoDB (Ensure that you have a running MongoDB instance)
- Postman (For API testing)
-
Clone the repository:
git clone https://github.com/rohanthakur336/Restaurant_Bot.git
-
Navigate to the project directory:
cd food-app
-
Install the required dependencies:
npm install
-
Set up environment variables by creating a
.env
file in the root directory:touch .env
Add your environment variables (e.g., MongoDB URI, API keys, JWT secret) to the
.env
file. -
Start the application:
npm start
-
Import the Postman Collection:
- Import the provided Postman collection into your Postman app. The collection includes all necessary requests for testing the API endpoints.
-
Base URL:
- Set the base URL to
http://localhost:8080/api/v1
in your Postman environment settings.
- Set the base URL to
-
Available Endpoints:
- User Authentication:
POST /auth/register
- Register a new user.POST /auth/login
- Log in as an existing user.
- Restaurant Discovery:
GET /restaurants
- Retrieve a list of restaurants.GET /restaurants/:id
- Retrieve details of a specific restaurant.
- Menu Browsing:
GET /restaurants/:id/menu
- Retrieve the menu for a specific restaurant.
- Reservations:
POST /reservations
- Make a reservation at a restaurant.GET /reservations/:id
- Retrieve details of a specific reservation.
- Order Management:
POST /orders
- Place an order at a restaurant.GET /orders/:id
- Retrieve details of a specific order.
- Payments:
POST /payments
- Process a payment.
- User Authentication:
-
Testing the API:
- Login Example:
- URL:
http://localhost:8080/api/v1/auth/login
- Method:
POST
- Body (JSON):
{ "email": "user@example.com", "password": "yourpassword" }
- Use Postman to send a POST request to the above URL to log in.
- URL:
- Other Requests:
- Use the endpoints provided in the list above to interact with the API. You can create, retrieve, update, and delete resources using the corresponding HTTP methods (GET, POST, etc.).
- Login Example:
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.