Categorygithub.com/fnplus/news-api
modulepackage
0.0.0-20191226174517-301f0f8d5796
Repository: https://github.com/fnplus/news-api.git
Documentation: pkg.go.dev

# README

news-api

FOSSA Status

A bot/worker/cron/process to fetch & curate all the relevant news content from the web based on the user's subscription.

How it works

This service is responsible for fetching the news related to the keywords that the users have subscribed to. The list of all keywords that users have subscribed to are present in the database.

  • The keywords are first fetched
  • Multiple workers are created to to fetch news concurrently
  • The keyqords are queued for the workers to pickup
  • Once a worker picks up a keyword, it will fetch the news from newsapi.org's REST api
  • Once the news is fetched, they are pushed to the database and the titles are cached locally. Because, the next time when the news is fetched, the same news should not be pushed to the dB again and again

This procedure is run multiple times in a day. Keep in mind, only the "new" news is sent to the database.

Installation

  1. First, fork and clone the repo. This will create a new folder named news-api.
  2. Navigate to /news-api and run:
go get -d
go build
./news-api

How to contribute

Read this

License

FOSSA Status

# Packages

No description provided by the author

# Functions

NewQueue creates a new instance of a queue.
NewWorker creates a new instance of iWorker.

# Structs

Queue to perform FIFO.
Worker implements the iWorker interface.

# Interfaces

IWorker interface to work with multiple sources of news and put it all into the data store.