/twitter-streaming

Twitter Streaming Application written in Golang

Primary LanguageGoMIT LicenseMIT

A Simple Twitter Streaming Application written in #Golang

Build Status Build status Go Report Card

First Step

Install Required Dependencies

To install required dependencies, just run the make initialize command. It fetches all golang dependencies and nodejs packages. Don't forget to add make, go, npm must be in PATH enviropment variables.

Running

After installing required dependencies, you can build and run the program. Then run these commands one by one:

  • To build backend module run make build
  • To build and copy them into the public folder, execute make build-copy-frontend-files

Now you can run the program with ./twitterStreaming command. Execute ./twitterStreaming -h to get help about program.

twitterStreaming -v => Display version
twitterStreaming -h => Display usage
twitterStreaming -config=config.json => Set the config file
               config.json
               {
                   "Port":3000,
                   "Twitter" : {
                        	"ConsumerKey":"xxx"
                        	"ConsumerKeyConsumerSecret":"xxx"
                        	"ConsumerKeyAccessTokenKey":"xxx"
                        	"ConsumerKeyAccessTokenSecret":"xxx"
                    }
               }

Run at Docker

You can run it with this command: docker run -it --dns 8.8.8.8 -p 3000:3000 rayyildiz/twitter-streaming

Configuration

Application looks for a config.json in current folder (defualt). However you can change the config file by ./twitterStreaming -config=abc.json

{
    "Port":3000,
    "Twitter" : {
			"ConsumerKey":"xxx"
	      		"ConsumerKeyConsumerSecret":"xxx"
	      		"ConsumerKeyAccessTokenKey":"xxx"
	      		"ConsumerKeyAccessTokenSecret":"xxx"
	      }
}

Twitter Configuration

You need to register an application at https://dev.twitter.com. Just go to https://apps.twitter.com/app/new and create an application. After that you need Consumer Key (API Key) , Consumer Secret (API Secret) , Access Token , Access Token Secret . Also don't forget the change persmision your account as Read only

Change these values with yours in config.json. There is a sample config information by default.

Now just execute make run and hit the http://localhost:3000 (if port is 3000 in config.json)

Run Application at Docker

If you have problem and install the docker, you can execute make docker build and make docker-run . This commans build and run the application at docker.

You can find the docker image at https://hub.docker.com/r/rayyildiz/twitter-streaming/