A simple application to consume recipe api services. This is for demo purposes and created to demonstrate architectural & programming skills.
Below are the key-design points, and how its been handled & implemented.
Development environment requirements:
Setting up your development environment on your local machine using setup script:
$ git clone https://github.com/ahsanatiq/no-framework-api
$ cd ahsanatiq-api-test
$ git checkout dev
$ ./setup.sh
Manual setup:
$ git clone https://github.com/ahsanatiq/no-framework-api
$ cd ahsanatiq-api-test
$ git checkout dev
$ cp recipe-service/.env.dev recipe-service/.env
$ cp oauth-service/.env.dev oauth-service/.env
$ cp search-service/.env.dev search-service/.env
$ cp web-service/.env.dev web-service/.env
$ docker-compose up -d
$ docker exec -it ahsanatiq-recipe-service composer install
$ docker exec -it ahsanatiq-oauth-service composer install
$ docker exec -it ahsanatiq-search-service composer install
$ docker exec -it ahsanatiq-web-service composer install
$ docker exec -it ahsanatiq-recipe-postgres createdb -U hellofresh -O hellofresh hellofresh_testing
$ docker exec -it ahsanatiq-postgres-oauth createdb -U hellofresh -O hellofresh hellofresh_testing
$ docker exec -it ahsanatiq-oauth-service openssl genrsa -out /server/keys/id_rsa 2048
$ docker exec -it ahsanatiq-oauth-service openssl rsa -in /server/keys/id_rsa -pubout -out /server/keys/id_rsa.pub
$ docker exec -it ahsanatiq-recipe-service php vendor/bin/phinx migrate
$ docker exec -it ahsanatiq-oauth-service php vendor/bin/phinx migrate
$ docker exec -it ahsanatiq-oauth-service php vendor/bin/phinx seed:run
$ docker exec -it ahsanatiq-oauth-service php vendor/bin/phinx migrate -e testing
$ docker exec -it ahsanatiq-oauth-service php vendor/bin/phinx seed:run -e testing
$ docker exec ahsanatiq-search-service nohup /usr/bin/php /server/http/console.php consume:recipes &
Now you can access the application via http://localhost:8000.
Run the unit-tests in the Recipe-Service container:
$ docker exec -it ahsanatiq-recipe-service php vendor/bin/codecept run
Run the acceptance-tests in the Web-Service container:
$ docker exec -it ahsanatiq-web-service php vendor/bin/codecept run
You can access the public API documentation at Postman. To import and run all the API's, click "Run In Postman" on top bar, after installing and importing you will see the new collection as "HelloFresh-Recipes API". To access the protected API's, you need to run generate the token first from "Authentication -> Get Token" endpoint. Then update the "access_Token" in the "HelloFresh-Dev" environment setting by clicking on the top-right corner inside postman app.