Skip to content

mayflower-tech/backend-php-test-task

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Statistics API

Template for a lightweight PHP micro-service to record and expose per-country usage statistics.

Getting Started

Build containers, install PHP dependencies, and start the stack:

make up

Endpoints

Update Statistics

curl -X POST http://127.0.0.1:8088/v1/statistics \
     -H "Content-Type: application/json" \
     -d '{"countryCode": "ru"}'

Response:

201 Created

Wrong country code example:

curl -X POST http://127.0.0.1:8088/v1/statistics \
     -H "Content-Type: application/json" \
     -d '{"countryCode": "wrongCountry"}'

Response:

201 Created

Get Country Statistics

curl -X GET http://127.0.0.1:8088/v1/statistics \
     -H "Content-Type: application/json"

Response:

{
  "ru": 813,
  "us": 456,
  "it": 92,
  "de": 17,
  "cy": 123
}

Run Unit Tests

Execute the full PHPUnit suite:

make unit-test

Run Load Tests

make load-test

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors