From baf05757a1fb975bbf35fededd288c82b5f10c61 Mon Sep 17 00:00:00 2001 From: dwivedikunal100 Date: Thu, 1 Nov 2018 19:56:00 +0530 Subject: [PATCH] Delete index1.js --- index1.js | 67 ------------------------------------------------------- 1 file changed, 67 deletions(-) delete mode 100644 index1.js diff --git a/index1.js b/index1.js deleted file mode 100644 index 336dee8..0000000 --- a/index1.js +++ /dev/null @@ -1,67 +0,0 @@ -/* -Created By:Kunal Dwivedi on 27/10/2018 -*/ - -//Declaration -const express = require('express'); -const app = express(); -var twitter = require('twitter'); - -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 request -app.get('/loaddata', function (req, res) -{ - var funcvalue,output; - twitter.get('search/tweets', {q: 'earthquake'}, function(error, tweets, response) { - - - if(response.statusCode==429){ - res.send("Too many requests"); - } - else{ - var op=''; - for(var i in tweets.statuses){ - - var output=""; - output+=""+tweets.statuses[i].user.name+""; - output+=""+tweets.statuses[i].text+""; - output+=""+tweets.statuses[i].created_at+""; - output+=""+tweets.statuses[i].user.location+""; - output+=""; - if(tweets.statuses[0].created_at==newpost){ - output=""; - } - op+=output; - } - newpost=tweets.statuses[0].created_at; - res.send(op); -} - }); -}); - - - - - -//Website Redirection -app.get('/',(req, res) =>res.render('index')); -app.get('/about',(req,res)=> res.render('about')); -app.get('/displayonmap',(req,res)=>res.render('displayonmap')); -app.get('/displaytweets',(req,res)=> res.render('displaytweets')); - - -//Initialization -app.listen(3000, () => console.log(`Initiated @ localhost:3000`));