Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var express = require("express");
- var bodyParser = require("body-parser");
- var request = require("request");
- var Twitter = require('twitter');
- var cors = require('cors')
- var client = new Twitter({
- consumer_key: 'SKlsKtf2nGjuS3uPnY2z3QWyw',
- consumer_secret: 'dIb2BfHhWj41mvwCOD61F43vUP2ObBg4XerEK0vaaIV6OsnXqM',
- access_token_key: '112909344-j9uo5IDCxFFBt9EClc54c1pp3hdJa7xoDXXOIeth',
- access_token_secret: 'CFDMaUeQeJU5XL9sWXtKXSTGsJMVDLQq2O44UToMHyfI5'
- });
- var app = express()
- app.use(cors())
- process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
- app.set("port", (process.env.PORT || 5000));
- // Process application/x-www-form-urlencoded
- app.use(bodyParser.urlencoded({
- extended: false
- }));
- // Process application/json
- app.use(bodyParser.json());
- // for Facebook verification
- app.get("/twitter/", function(req, res) {
- var pais = req.query["busca"];
- var params = {screen_name: 'nodejs'};
- client.get('search/tweets', {q: pais}, function(error, tweets, response) {
- // console.log(tweets);
- res.send(tweets)
- });
- });
- app.listen(app.get("port"), function() {
- console.log("running on port", app.get("port"))
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement