Lunch Microservice

The service provides an endpoint that will determine, from a set of recipes, what I can have for lunch at a given date, based on my fridge ingredient's expiry date, so that I can quickly decide what I’ll be having to eat, and the ingredients required to prepare the meal.

Prerequisites

Note: Docker is used for the local MySQL database instance, feel free to use your own instance or any other SQL database and insert data from lunch-data.sql script

Run

  1. Start database:

    docker-compose up -d
    
  2. Add test data from sql/lunch-data.sql to the database. Here's a helper script if you prefer:

    CONTAINER_ID=$(docker inspect --format="{{.Id}}" lunch-db)
    
    docker cp sql/lunch-data.sql $CONTAINER_ID:/lunch-data.sql
    
    docker exec $CONTAINER_ID /bin/sh -c 'mysql -u root -prezdytechtask lunch </lunch-data.sql'
    
  3. Run Springboot LunchApplication

Update 2021-01-12

  1. The /lunch endpoint has been updated to GET method. Two params for this endpoint:

    1.1 The date param is required and should provide in ISO standard. For example:

    locahost:8080/lunch?date=2020-01-12
    

    1.2 The exclude param is optional and the default value is null, if provide should be ingredients seperated by ",". For example:

    localhost:8080/lunch?date=2020-01-12&exclude=ham,hotdog
    
  2. New endpoint /recipe added to get recipe by title. If no recipe with the title return 404 status. For example:

    localhost:8080/recipe?title=ham
    
  3. Tests cover database connections, ORM and manual tests on REST API with Postman