Skip to content

Sahibjot01/BlogAggregator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blog Aggregator

This is a small command-line RSS reader written in Go.

Requirements

You need both Go and Postgres installed to run this program.

Install the CLI

Install the CLI with go install:

go install github.com/sahibjot01/blogaggregator@latest

If you are working from a fork or a different module path, replace the import path with the one for your repo.

The command examples below use gator as the binary name. If your installed binary has a different name, use that name instead.

Set up the database

Before the CLI can save anything, the Postgres database and schema need to exist.

If you do not already have a gator database, create one first:

createdb gator

Then apply the migrations from the sql/schema directory:

goose -dir sql/schema postgres "postgres://user:password@localhost:5432/gator?sslmode=disable" up

That creates the tables the CLI expects, including users, feeds, feed follows, and posts.

Configure the app

The program reads its config from ~/.gatorconfig.json.

Create that file with your Postgres connection string and the current user name:

{
  "db_url": "postgres://user:password@localhost:5432/gator?sslmode=disable",
  "current_user_name": ""
}

db_url should point to your local Postgres database. If you are using a different user, password, host, or database name, update the value accordingly.

Run the program

After installing, run the CLI from anywhere on your machine.

gator register <name>
gator login <name>

The first command creates a user and switches to it. The second command switches to an existing user.

Useful commands

  • gator users prints all users in the database.
  • gator feeds lists all registered feeds.
  • gator addfeed <name> <url> creates a feed and follows it for the current user.
  • gator follow <url> follows an existing feed.
  • gator unfollow <url> stops following a feed.
  • gator following shows the feeds the current user follows.
  • gator browse <limit> shows posts for the current user, up to the limit you pass in.
  • gator agg <duration> keeps fetching feeds on a timer, for example gator agg 1m.
  • gator reset clears the users table and resets the current user in the config.

Notes

If you change the database name, user, or password, update both the Postgres connection string and the migration command to match.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages