- Docker as the container service to isolate the environment.
- Php to develop backend support.
- Laravel as the server framework / controller layer
- MySQL as the database layer
- NGINX as a proxy / content-caching layer
- Clone the repo
- Set Google Distance API key in environment file located in ./code .env file
- Run
./start.shto build docker containers, executing migration and PHPunit test cases - After starting container following will be executed automatically:
- Table migrations using artisan migrate command.
- Dummy Data imports using artisan db:seed command.
- To run manually migrations use this command
docker exec manage_order_php php artisan migrate - To run manually data import use this command
docker exec manage_order_php php artisan db:seed
- You can run
docker-compose upfrom terminal - Server is accessible at
http://localhost:8080 - Run manual testcase suite by :
docker exec manage_order_php php ./vendor/phpunit/phpunit/phpunit /var/www/html/tests/Feature/OrderControllerTest.php
Test Cases can be executed by:
-docker exec manage_order_php php ./vendor/phpunit/phpunit/phpunit /var/www/html/tests/Feature/OrderControllerTest.php
-
GET
/orders?page=:page&limit=:limit: Fetch paginated orders- Response :
[ { "distance": 1199398, "status": "TAKEN", "id": "5bebba7c1c2c2d001c3e92f3" }, { "distance": 2000, "status": "UNASSIGNED", "id": "5bebba7c1c2c2d001c3e92f1" }, ] -
POST
/orders: Create a new order- Request:
{ "origin" :["28.704060", "77.102493"], "destination" :["28.535517", "77.391029"] }- Response:
{ "id": "5bebcf381c2c2d001c3e92f4", "distance": 1071, "status": "UNASSIGNED" } -
PATCH
/orders/:id: Update the status of a particular order using it's id- Request:
{ "status" : "TAKEN" }- Responsw:
{ "status": "SUCCESS" }
./tests
- this folder contains test cases written under /tests/Feature/OrderControllerTest.php & /tests/Unit/OrderUnitTest.php
./app
-
Contains all the custom files for controllers, models and helpers.
-
migration files are written under database folder in migrations directory
- To run manually migrations use this command
docker exec manage_order_php php artisan migrate
- To run manually migrations use this command
-
Dummy data seeding is performed using faker under database seeds folder
- To run manually data import use this command
docker exec manage_order_php php artisan db:seed
- To run manually data import use this command
-
OrderControllerin ./app/Http/Controllers folder contains all the api methods. -
Modelsclass contains all helper methods. -
Helperclass contains all helper methods. -
PHPUnit.xml provides the unit test case and code coverage
.env
-
config contains all project configuration like it provides app configs, Google API Key, database connection
-
Set Google Distance API key
./code/Readme
- API Reference documentation file contains all method references.