Skip to content

dhirajpatra/flex_recipes_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flex_recipes_api

This is a small php symfony flex based api back end. Using PHP Symfony based Flex as MVC and used Docker to install and run the application.

Language : English

PHP Technical Task

Suggested recipes for lunch API

User Story

As a User I would like to make a request to an API that will determine from a set of recipes what I can have for lunch today based on the contents of my fridge, so that I quickly decide what I’ll be having.

Acceptance Criteria

  • Given that I have made a request to the /lunch endpoint I should receive a JSON response of the recipes that I can prepare based on the availability of ingredients in my fridge.
  • Given that an ingredient is past its use-by date (inclusive), I should not receive recipes containing this ingredient.
  • Given that an ingredient is past its best-before date (inclusive), but is still within its use-by date (inclusive), any recipe containing the oldest (less fresh) ingredient should placed at the bottom of the response object.

Additional Criteria

  • The application SHOULD contains unit / integration tests (e.g. PHPUnit).
  • The application MUST be completed using an OOP approach.
  • The application MUST be PSR compliant.
  • Any dependencies MUST be installed using Composer (no need to commit dependencies, the composer.lock file will be sufficient).
  • Use PHP5.6 or PHP7.
  • Any installation, build steps, testing and usage instructions MUST be provided in a README.md file in the root of the application.

Framework

Use the Symfony micro framework Flex (https://symfony.com/doc/current/setup.html) to create the application API.

Application Data

For the purpose of this task, the application should simply read data from 2 x JSON files. The contents for these files can be found here and here.

How to install

git pull {repoaddress}

How to test

cd code from root folder sudo ./bin/phpunit

How to run

sudo docker-compose up

at browser or at REST API client

http://localhost/api/lunch/{best-before}/{use-by} eg. http://localhost/api/lunch/2019-03-07/2019-03-10

issue regarding permission if any

sudo chmod -R 775 code

About

This is a small php symfony flex based api back end

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published