- Notifications
You must be signed in to change notification settings - Fork0
ilmarin/points
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Simple example of API that allows to store some interesting places with their map coordinates and description.
With this API you can:
- Add Point info (name, description, coordinates, city)
- Edit Point info
- Get nearest Points by desired radius and IP address
- Get Points located in desired city
- In project folder execute
docker-compose up -d
- Enter container with
docker exec -ti points bash
- Execute
composer install
- Rename
.env.example
file into.env
- Execute
./artisan migrate --force
to run database migrations - In
.env
file write yourIP_STACK_KEY
andAPI_TOKEN
- Check api status by address
http://localhost:8080/api/v1/health?api_token=123
To run unit tests executevendor/bin/phpunit tests/unit
insidepoints
container.
To run only functional tests executevendor/bin/phpunit tests/functional
.
To run all tests executevendor/bin/phpunit
.
All requests must containapi_token
parameter withAPI_TOKEN
environment variable value.
Example:GET /api/v1/health?api_token=123
Get health status of the service.
URL:GET /api/v1/health
Endpoints for viewing and manipulating points.
- Add Point:
POST /api/v1/points
- Update Point:
PUT /api/v1/points/:pk
- Show points by desired ip and radius:
GET /api/v1/points/inrad
- Show points in desired city:
GET /api/v1/points/in/:city