API to manage geo data by ip or url
Copy and set environment variables with:
cp .env.example .env
Build and run application with:
docker-compose up --build
docker-compose run web rails db:create db:migrate
GET: /geolocations?query=http://example.com
GET: /geolocations?query=192.168.0.1
query
parameter accepts URL and IP formats
Response examples:
{
"id": 1,
"ip": "123.123.123.121",
"query": "123.123.123.121",
"country": "China",
"city": "Beijing",
"zip": "China",
"latitude": "39.91175842285156",
"longitude": "116.37922668457031",
"created_at": "2022-02-26T10:30:44.625Z",
"updated_at": "2022-02-26T10:30:44.625Z"
}
{
"errors": {"detail": "Not Found"}
}
DELETE: /geolocations?query=http://example.com
DELETE: /geolocations?query=192.168.0.1
query
parameter accepts URL and IP formats
Response examples:
"ok"
{
"error": "not found"
}
- Provide more detailed responses by applying JSON API standard
- Improve test coverage by adding model & controller specs
- Make API endpoints secure by restricting access via JWT