Location Service
Problem Statement :
Design and implement a location search micro service, whose sole purpose is be to
expose APIs for searching cities and their localities.
You are free to use any backend language and frameworks.
Submit your answer as a Git repository hosted on any of the major platforms like GitHub,
Bitbucket, etc.
Assumptions
- You have a massive database of cities and their localities.
- Every request you receive contains a custom header X-Geo-LatLng which contains the latitude and longitude of the request origin.
- You are not expected to implement an front-end application for this problem statement, just expose APIs that return JSON formatted results. Tasks
Design the database schema as per the following,
You have list of city names.
You have list of city locality names, along with their latitude and longitude, and in which city the locality lies.
Expose an API, where a user enters some text and the service returns the first 5 relevant city/locality simulating a type-ahead search. For e.g., if a user enters the text mum , the results should be like Mumbai, Mumbra, Mumbai Central, etc.
The result of the above should be sorted on the basis of geo-distance from the current location (note the above assumption no.
2). Expose another API, where the user enters a latitude and longitude, and the service returns all the city localities within a geo-distance of 10 kms and sorted on the basis of their respective distance from the user input.
Since above APIs would be public, you are also required to apply Rate Limiting of 100 requests per minute per IP address on the above exposed APIs.