Giter VIP home page Giter VIP logo

getting-tweets's Introduction

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 ๐Ÿ’œ๐Ÿ’œ๐Ÿ’œ

getting-tweets's People

Contributors

bychanderzap avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.