This is a RESTful API for managing a restaurant's operations, including customers, menu, orders, food, table, and invoice. It is built using the Gin framework for handling HTTP requests and MongoDB as the database.
- Customers: Manage customer information such as name, email, phone, and address.
- Menu: Add, update, and delete menu items for each restaurant, along with their details and pricing.
- Orders: Create, update, and delete orders for customers along with their details and pricing.
- Food: Create, update, and delete food for customers along with their details and pricing.
- Table: Create, update, and delete tables for customers for reservation.
- Invoice: Create, update, and delete invoice for customers along with their details and pricing.
- Go (1.16+)
github.com/gin-gonic/gin
(Gin framework)github.com/dgrijalva/jwt-go
(JWT library)github.com/joho/godotenv
git clone https://github.com/methlox/restaurant-mgmt-go/
cd restaurant-mgmt-go
go get -u github.com/gin-gonic/gin
go get -u github.com/dgrijalva/jwt-go
go get -u github.com/joho/godotenv
go mod tidy
go run main.go
The API provides endpoints to perform various operations on customers, menu, orders, food, table, and invoice.
- The User model represents a user (admin) of the restaurant.
GET /users
: Get all usersGET /users/{user_id}
: Get a specific user.POST /auth/register
: Register a userPOST /auth/login
: Login a user and get a JWT token
GET /menus
: Get all menu items for a restaurant.GET /menus/{menu_id}
: Get a specific menu item.POST /menus
: Add a new menu item to a restaurant.PATCH /menus/{menu_id}
: Update a menu item.
GET /orders
: Get all orders for a restaurant.GET /orders/{order_id}
: Get a specific order.POST /orders
: Add a new order to a restaurant.PATCH /orders/{order_id}
: Update a order.
GET /orderItems
: Get all order items for a restaurant.GET /orderItems/{orderItem_id}
: Get a specific order item.GET /orderItems/{order_id}
: Get a specific order item of a order.POST /orderItems
: Add a new order item.PATCH /orderItems/{orderItem_id}
: Update a order item.
GET /tables
: Get all tables for a restaurant.GET /tables/{table_id}
: Get a specific table.POST /tables
: Add a new table to a restaurant.PATCH /tables/{table_id}
: Update a table.
GET /invoices
: Get all invoices for a restaurant.GET /invoices/{invoice_id}
: Get a specific invoice.POST /invoices
: Add a new invoice to a restaurant.PATCH /invoices/{invoice_id}
: Update an invoice.
The API supports authentication using JSON Web Tokens (JWT). To access protected endpoints, clients must include a valid JWT token in the Authorization header of their requests.
Contributions are welcome! Please follow the standard guidelines for contributing to open-source projects.
This project is licensed under the MIT License. See the LICENSE file for details.
Special thanks to Gin and Mongo DB for providing excellent tools to build this API.