A (minor) modification to KeystoneJS to add a few custom APIs for:
- Populating a connected MongoDB with retail stores (e.g. Macy's or BestBuy) and their addresses, geocoordinates, storeId and more
- A basic geofencing API (to be used from mobile devices) that when sending a lat/long pair determines:
- If the request location is NEAR any stores (as a teaser)
- If the request is IN any store (to unlock a special offer)
http://<SERVER_ADDRESS>:<PORT>/api/nearby/30.3557437/-97.7239443
In this example, the mobile user coordinates are:
- Latitude: 30.3557437
- Longitude: -97.7239443
[
{
"isTeaser": false,
"name": "Macy's - North Central Mall",
"retailer": "Macy's",
"isInactive": false,
"latitude": 30.3557437,
"longitude": -97.7239443,
"discountPct": 19,
"_id": "533ec620e461e638847f2856",
"__v": 0
},
{
"isTeaser": true,
"name": "Macy's - Bee Cave",
"retailer": "Macy's",
"isInactive": false,
"latitude": 30.3557437,
"longitude": -97.7129443,
"discountPct": 17,
"_id": "533ec620e461e638847f2857",
"__v": 0
}
]