Demo of 47Deg/Fetch library to grab Hacker News stories and comments
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
project
src/main
.gitignore
.sbtopts
LICENSE
README.md
build.sbt

README.md

hnfetchjs

Summmary

This is a project to demo several libraries at once:

  • 47Deg's Fetch library to grab Hacker News stories
  • Udash to build an interative website frontend entirely in Scala
  • Reftree to visualize data structures graphically

View the project live

Or watch a video

Fetch is a Scala library inspired by Haxl which makes it easier to work with data sources that have latency (DB's, web services etc). In this example I use the Hacker News API as a data source. Once a Fetch is executed Fetch Stories you can click the Last Fetch tab to view a visualization of the Fetch operation. This shows a list of "rounds", how long they took and how many items were fetched. If you try to get the same stories again you will see that the Fetch diagram is simply Nil, because the items were already cached. You can clear the cache and run the fetch again.

Goals of this project

  • Learn more about the Fetch library. Writing a custom cache and porting JVM code to Scala.js
  • Provide a sandbox to demonstrate the Fetch using Reftree to visualize the rounds

This project is not

  • A useful Hacker News client, although it could easily be extended to be one

Installation

After cloning the repository and installing sbt you can build the frontend files and serve them from a local server using

sbt
~fastOptJS

You can now edit the Scala files to make changes and view the site at http://localhost:12345/target/UdashStatic/WebContent/index.html

To publish the final pages

set isSnapshot := false
compileStatics

The final output files will be located in the folder hnfetchjs/target/UdashStatic/WebContent/

Copyright

hnfetchjs is developed by Justin Heyes-Jones

Copyright (C) 2017 Justin Heyes-Jones