REST api for a kiosk in a fast food restaurant
- Clone the repository
- Run
npm i
to install dependencies - install MySQL and create a database, either import the kiosk-api.sql file or import your own data
- edit the config.js file with your database credentials
- Run
npm start
to start the server
When trying to use the API, the header must contain the right api key.
The key must be sent in the header as key
. The value of the key is stored in the config.js file and can be changed there.
/api/menu: gets all menu items
/api/menu/{id}: gets specific menu item
/api/menu/category/{id}: gets menu items from a category
/api/ingredients/: gets all ingredients
/api/ingredients/{id}: gets specific ingredient
/api/ingredients/category/{id}: gets ingredients from a specific category
/api/orders: gets all orders
/api/order: creates a new order
Requires a JSON object in the req body with the following format:
{
"orderItems": [
{
"menuItemId": 1,
"quantity": 2
},
{
"menuItemId": 2,
"quantity": 1
}
]
}
Sends back the order id