diff --git a/index.js b/index.js deleted file mode 100644 index 8d9e9df..0000000 --- a/index.js +++ /dev/null @@ -1,87 +0,0 @@ -/* -Created By:Kunal Dwivedi on 27/10/2018 -*/ - -//Declaration -const express = require('express'); -const app = express(); -var twitter = require('twitter'); -var NodeGeocoder = require('node-geocoder'); -var options = { - provider: 'google', - httpAdapter: 'https', - apiKey: 'AIzaSyCXLoGrNXHCazTfVETItNy95g8lJPurI4w', - formatter: null -}; -var geocoder = NodeGeocoder(options); -var twitter = new twitter({ - consumer_key: 'mOUpwzhjCGYrPpqBL03n8cbtg', - consumer_secret: 'CFEMDfwkiMnLAO7ofi0ConXlDAmwqUmaAKkx8XQRtfQnMWxI4N', - access_token_key: '261608471-ATGdO8ydPJ3l36vMKJgqTSecpoQZsHNIaBbXjJCJ', - access_token_secret: 'Lwo2SrXGLHapLoXhp3LWiWELpnT1JhPcCEvEgsRmlrkKZ' -}); - -// front-end declarations -app.set('view engine','ejs'); -app.use(express.static('public')); - -//Ensure unique tweets are published -var newpost="first"; - -/************Async requests*********/ -//for displaying tweets -app.get('/loadlocation', function (req, res) -{ - twitter.get('search/tweets', {q: 'earthquake',count:1}, function(error, tweets, response) { - if(error){ res.send({statusCode:404,statusMessage:"INTERNET NOT WORKING"}); } - else{ - if(response.statusCode!=200){res.send({statusCode:400,statusMessage:response.statusMessage});} - else{ - geocoder.geocode(tweets.statuses[0].user.location, function ( err, data ) { - if(err){res.send({statusCode:400,statusMessage:"Error: Status is OVER_QUERY_LIMIT."}); } - else{res.send({statusCode:200,latitude:data[0].latitude,longitude:data[0].longitude});} - }); - } - } - }); -}); - - -app.get('/loaddata', function (req, res) -{ - var funcvalue,output; - twitter.get('search/tweets', {q: 'earthquake',count:1}, function(error, tweets, response) { - if(error || tweets.statuses===undefined){ - res.send("