A REST API for managing restaurant orders, including table sessions, order flow, and related entities such as products and tables.
- Express
- Knex.js
- Node.js
- SQLite
- TypeScript
Follow the steps below to run the project locally in a development environment.
Clone the repository.
git clone https://github.com/rafael-vaz/restaurant-apiRun the project.
# 1. Navigate to the project directory
cd restaurant-api
# 2. Install dependencies
npm install
# 3. Run database migrations (Knex)
npm run knex migrate:latest
# 4. Start the development server
npm run devThis section lists the main API routes and describes their expected request bodies.
| Method | Endpoint | Description | Request Body |
|---|---|---|---|
| GET | /products |
List all products | — |
| POST | /products |
Create a new product | { name, price } |
| PUT | /products/:id |
Update a product | { name, price } |
| DELETE | /products/:id |
Delete a product | — |
| Method | Endpoint | Description | Request Body |
|---|---|---|---|
| GET | /tables |
List all tables | — |
| Method | Endpoint | Description | Request Body |
|---|---|---|---|
| POST | /tables-sessions |
Open a table session | { table_id } |
| GET | /tables-sessions |
List table sessions | — |
| PATCH | /tables-sessions/:id |
Close a table session | — |
| Method | Endpoint | Description | Request Body |
|---|---|---|---|
| POST | /orders |
Create a new order | { table_session_id, product_id, quantity } |
| GET | /orders/table-session/:tableSessionId |
List orders by table session | — |
| GET | /orders/table-session/:tableSessionId/total |
Show total for a table session | — |