A simple way to store and find location using NodeJS
, MongoDB
, Express
- Add new location
- Find nearest locations
- Install packages
$ yarn install
- Connect database
Change your MongoDB URI in "config/vars.config.js"
- Run project
$ yarn start
POST
domain
/api/v1.0/locations
Body Parameters
{
"longitude": 106.6462473,
"latitude": 10.7835932,
"name": "Viva Star Coffee"
}
GET
domain
/api/v1.0/locations?longitude=106.6755828&latitude=10.8079706&limit=10&distance=1000
Query Parameters
Name | Type | Description |
---|---|---|
longitude | Number (Float) | Location longitude |
latitude | Number (Float) | Location latitude |
limit | Number (Int) | Default = 10 |
distance | Number | Default = 8000 (meter) |
Hoang Trung Hieu
- Email: info@hieuht.com
- Facebook: https://www.facebook.com/trunghieuhth
- Twitter: https://www.twitter.com/trunghieuhth