/kiosk-api

REST api for a kiosk in a fast food restaurant

Primary LanguageJavaScriptGNU General Public License v3.0GPL-3.0

kiosk-api

REST api for a kiosk in a fast food restaurant

Installation

  1. Clone the repository
  2. Run npm i to install dependencies
  3. install MySQL and create a database, either import the kiosk-api.sql file or import your own data
  4. edit the config.js file with your database credentials
  5. Run npm start to start the server

Usage

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.

Endpoints

GET:

/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

POST:

/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