Skip to content

pierrechls/twitter-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

22 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

version

๐Ÿฅ Twitter API

A simple Node.js Twitter API

โ• Prior installation

Install external dependencies

Create Twitter application

Create a Twitter application from Twitter developer platform.

๐Ÿ”ฉ How to install ?

Clone the repo

$ git clone https://github.com/pierrechls/twitter-api.git

Install dependencies

$ yarn install

๐Ÿ› ๏ธ How to configure ?

Environnement settings

  • Create .env file by running :
$ cp .env.example .env
  • Set your configuration :
# API
API_URL="<YOUR_API_URL>"   # Your local API URL (for example: `http://localhost)
API_PORT="<YOUR_API_PORT>" # Your local API port (for example: `3000`)

# TWITTER
TWITTER_USERNAME="<YOUR_TWITTER_USERNAME>"               # Username
TWITTER_CONSUMER_KEY="<YOUR_CONSUMER_KEY>"               # API key
TWITTER_CONSUMER_SECRET="<YOUR_CONSUMER_SECRET>"         # API secret key
TWITTER_ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>"               # Access token
TWITTER_ACCESS_TOKEN_SECRET="<YOUR_ACCESS_TOKEN_SECRET>" # Access token secret

๐ŸŽฎ How to use it ?

Run server

$ yarn server

Use APIs

Method URL Description Twitter API reference
GET /tweets Returns a collection of the most recent Tweets posted by the user indicated by the screen_name or user_id parameters. statuses/user_timeline

NB : you want another Twitter API ? Please open an issue or create a pull request

๐Ÿš€ How to deploy

Create Heroku application

You have to create a Heroku application from here

Adding Heroku remote url to git

Adding your Heroku application remote url to your local repository :

$ heroku git:remote -a <YOUR_HEROKU_APP_NAME>

Set Heroku config vars

Set environnement settings to your Heroku application :

$ heroku config:set TWITTER_USERNAME="<YOUR_TWITTER_USERNAME>" \
                    TWITTER_CONSUMER_KEY="<YOUR_CONSUMER_KEY>" \
                    TWITTER_CONSUMER_SECRET="<YOUR_CONSUMER_SECRET>" \
                    TWITTER_ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>" \
                    TWITTER_ACCESS_TOKEN_SECRET="<YOUR_ACCESS_TOKEN_SECRET>"

NB : you can also set yours Heroku config vars from the interface by going into the Settings application tab

Deploy to Heroku

$ git push heroku master

๐Ÿ“š Documentation

Please refer to the Twitter developer documentation.

๐Ÿ™Œ Contribute

Contributing to twitter-api it's a piece of ๐Ÿฐ. You have an idea about a new feature ? Fork the repo, do your stuff and open a pull request ! You can also report a problem or a suggestion by opening an issue.

๐ŸŽ‰ Credits

Project developed by pierrechls.