Skip to content

A simple CLI application to display top posts from HackerNews.

Notifications You must be signed in to change notification settings

emmpak/hackernews

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hacker News Top Posts

Build Status Coverage Status

A simple command line application which uses Hacker News API to get details for up to a 100 of the top posts.

Setup

Clone repository
  • Clone repository
  • cd to the project's root directory
Use Docker (preferred way)

This is the preferred way to use the application as you don't have to worry about setup of your local environment and minimize software installations.

Head to the Docker website and download the installation for your platform.

  • Run docker build -t hackernews . to build the image (note that this might take a few minutes if you don't haven't previously downloaded the base images)
  • Run docker run hackernews --posts 5 to build the container and run the application to see the top 5 posts from Hacker News
Use Ruby installation
  • Install ruby on your machine. For Windows, you can find some information here. If you are on Mac, I suggest you install Homewbrew(a package management system) and run brew install ruby.
  • Run gem install bundler
  • Run bundle install to install all of the required gems
  • Run ruby hackernews.rb --posts 5 to see the top 5 posts from Hacker News
Libraries
  • Faraday - HTTP library used for connecting to the API.
  • RSpec - Testing framework used for TDD of the application.
  • Webmock - Library used for stubbing HTTP requests to avoid hitting the API during development and testing.
Other solutions
  • Use this API and OpenURI to get posts with the details loaded in an array. It will be faster as you wound't need to make an API call for each story based on the ID. Need to consider who is maintaining the API as it's not the official one.
  • An alternative solution is to parse Hacker News using the Nokogiri library.

About

A simple CLI application to display top posts from HackerNews.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published