/geospatial-mongoose-nodejs

A simple way to store location in MongoDB

Primary LanguageJavaScriptMIT LicenseMIT

GEOSPATIAL MONGOOSE

dependencies Status License: MIT

A simple way to store and find location using NodeJS, MongoDB, Express

Feature

  • Add new location
  • Find nearest locations

Usage

  1. Install packages
    $ yarn install
  1. Connect database
    Change your MongoDB URI in "config/vars.config.js"
  1. Run project
    $ yarn start

API Documentation

[✔] Add new location

POST domain/api/v1.0/locations

Body Parameters

    {
    	"longitude": 106.6462473,
    	"latitude": 10.7835932,
    	"name": "Viva Star Coffee"
    }

[✔] Find locations

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)

AUTHOR

Hoang Trung Hieu