Created
October 27, 2016 06:38
-
-
Save shivasurya/05867d3e394ec5e32adf4d825eb8c3f2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'); | |
var http = require('http'); | |
var app = express(); | |
var body = require('body-parser'); | |
var geolib = require('geolib'); | |
app.use(body.urlencoded({ extended: false })) | |
// parse application/json | |
app.use(body.json()) | |
app.post('/location',function(req,res){ | |
var lat = req.body.lat; | |
var long = req.body.long; | |
console.log(lat+' '+long); | |
var dis = geolib.getDistance( | |
{latitude: lat, longitude: long}, | |
{latitude: 9.99, longitude: 78.0822 }); | |
console.log(dis); | |
res.send('okay'); | |
}); | |
http.createServer(app).listen(3000,'0.0.0.0'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment