Skip to content

Latest commit

 

History

History
62 lines (46 loc) · 1.89 KB

README.md

File metadata and controls

62 lines (46 loc) · 1.89 KB

Go Report Card

Redditracker :Real-Time Top Post Up Votes & Top Posting Users (Coding Challenge)

Overview

This application is designed to monitor a chosen subreddit.

Installation

  1. Clone the repository:

    git clone [email protected]:marcelluseasley/redditracker.git
  2. To build the application, run the following command:

    make build

    This will compile source code and create a binary named redditracker in the cmd/redditracker directory.

  3. To remove the binary, run the following command:

    make clean

Configuration

  1. Configure the API Token in a .env file (you will need to create it, since its in .gitignore):
    • Navigate to cmd/redditracker/.env.
     REDDIT_CLIENT_ID=''
     REDDIT_CLIENT_SECRET=''
     USER_AGENT=''

Running the Application

To run the application, use the following command:

make run PORT=8080 SUBREDDIT=TaylorSwift

This will run the redditracker binary with the specified port and subreddit. You can replace 8080 and TaylorSwift with the port number and subreddit you want to track.

Usage

Once the application is running, it will begin monitoring the specified subreddit. The statistics will be reported by navigating to (fill in your port):

    http://localhost:[PORT]/

You can also make a curl request to get a JSON response of results. The query parameter q is required and takes one of: all, posts, or users:

   curl --location 'http://localhost:[PORT]/data?q=[all,posts,users]'

License

This project is licensed under the MIT License.

Acknowledgments

  • Reddit API for providing the data used by this application.