This is a REST API using express framework, mongoose for MongoDB and babel for ES6.
NodeJs
MongoDB
$ git clone [email protected]:mehmetakinn/express-mongoose-babel-rest-api.git
$ cd express-mongoose-babel-rest-api
$ npm install
$ npm start
Visit http://localhost:3000
$ npm test
POST
request to /drivers
will creates new driver
{
"name": "John Doe",
"latitude": "40.98741409",
"longitude" "29.02519226"
}
GET
request to /drivers
will lists drivers
GET
request to /drivers/58d66cbbf3c1dc11a711ffb6
will return driver
PUT
request to /drivers/58d66cbbf3c1dc11a711ffb6
will update driver information
{
"latitude": "40.9824899",
"longitude" "29.02862549"
}
DELETE request to /drivers/58d66cbbf3c1dc11a711ffb6
will delete driver
GET request to /ride?latitude=40.98300825&longitude=29.022789&limit=5
will return nearest 5 drivers.
Note: limit is optional and default value is 3.
Live demo is hosted at heroku and available at: https://shrouded-tundra-42087.herokuapp.com