MyGate API for Backend Challenge
- Host code on GitHub (This is the repo)
- Host product on EC2 (Link to server)
- Your code should stand alone include a good readme / any libraries or dependencies should be codified into configuration and / or be built up using scripts that you provide. (This is a docker based deployment, so its totally standalone)
- Please list out any assumptions you have made (See the assumptions sections)
Given the data about Food Trucks in San Francisco : here (https://data.sfgov.org/d/rqzj-sfat). You will build an API that allows the following operations on this data set
- Search by name of applicant (GET /mygateapi/v1/foodTruck/search achieves this)
- Search by expiration date, to find whose permits have expired (GET /mygateapi/v1/foodTruck/search achieves this)
- Search by street name (GET /mygateapi/v1/foodTruck/search achieves this)
- Add/Delete new food truck entry to the data set ( POST /mygateapi/v1/foodTruck/ & DELETE /mygateapi/v1/foodTruck/{id} achieves this)
- Auto expiry of licenses (Achieved by Scheduling Tasks in Spring)
- Given one or multiple locations, predict which truck will be the best one to assign the job( POST /mygateapi/v1/foodTruck/search achieves this)
The code just needs docker to run it.
- Install Docker
sudo apt-get install docker-ce (Ubuntu/Debian)
sudo yum install docker (Redhat/CentOS)
- Build the image (It may take some time depending on your internet connection)
docker image build -t mygate .
- Run the image in background with ports 8090 for the API
docker run -p 8090:8090 -d mygate
- Access this API via http://127.0.0.1:8090/swagger-ui.html
- The DB is initially empty, we use the /loader API to populate the DB
- Most of the assumptions in contract are documented in the swagger documentations
- Latitude and Longitude are stored as strings and the distance computation are done on application level. They could have been handled at database level, which is not done here.
- 8090 port of host should be free
Please report any issues identified to me