Skip to content

This app get tweets and save them on redis, then you can get that saved tweets by an edpoint!

Notifications You must be signed in to change notification settings

ByChanderZap/getting-tweets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

getting-tweets

This app get tweets and save them on redis, then you can get that saved tweets by an edpoint!

getting started 🚀

Things that you need: 🛠️

Little guide to get redis and rabbit. 🛠️

~ Redis 📌

I installed Redis on WSL; to do that, follow the next steps

sudo apt update
sudo apt install redis-server

Confirm redis instaltion

sudo apt install redis-server 

Redis version

redis-server --version

Confirm that redis is connected

redis-cli ping

~ RabbitMQ

I used docker to run an image, if you want follow this option run the next command

docker run -d --hostname my-rabbit -p 5672:5672 -p 8081:15672 --name some-rabbit rabbitmq:3-management

docker required

How to use 📝

Instalación 🔧

npm install

Command to run

npm run dev

Inmediatly when you run the app, it will connect to twitter streaming and start listening for tweets

Configuration 🔧

I give you an example of the ".env" file, you just have to add there your values, raname ".env.example" to ".env" and the app will work perfectly

Change keywords that will the app looking for 🔗

By now the only way is change it manually accesing to src > server > routes > twitter.js There you will find:

const rules = [
        { 'value': 'platzi -is:retweet', 'tag': 'platzi_tweet'},
        { 'value': 'node -is:retweet', 'tag': 'node_tweet'},
        { 'value': 'open source -is:retweet', 'tag': 'open_source_tweet'}
    ]

You can change it or add more, and remember that you will need the tags for your gets; to create your own rules check this link

API 📦

There is only one endpoint, where you can get the tweets by two options:

  • Every tweet
  • Tweets with your keyword

How to use both of them.

  • Get every tweet; you will recive EVERY tweet that is saved in your DB.
  curl -X GET -H "Content-Type: application/json" -d localhost:3000/api/
  • Get only tweets that contains one of your keyword (Needs match with the "tag" that you asigned) BY NOW you have to made a get request with a body like this:
{
    "tweetsAbout": "platzi_tweet"
}
to: localhost:3000/api/

Contributing ✒️

Pull requests are welcome!. And if you have an idea for a feature and dont have time to do this, feel free to open a issue!

License 📄

MIT

Extra 🌈

You can comment the line 17 on src > index.js and it will run only the api, without the streaming with tweeter, made it if you want to do something only with your local data 💜💜💜

About

This app get tweets and save them on redis, then you can get that saved tweets by an edpoint!

Topics

Resources

Stars

Watchers

Forks