This is an implementation of the website Hacker News. It uses the official Hacker News API.
- Look at front page stories
- View nested comments for each story
- See a user's submitted stories
- That's about it.
The Hacker News API is pretty simple, and it only takes about 50 lines to comprehensively access it.
HTML is generated via the Hiccup library, which translates Clojure data structures into HTML. If Hiccup sounds interesting to you, you might be interested in making it yourself. It's a fun problem.
I match routes to route handlers using Compojure. I thought Compojure was pretty cool, so I made that, too.
Finally, Ring ties everything togther with a very simple HTTP interface.
At the moment, everything is done in Clojure. I plan to add some Clojurescript for collapsing comments, etc.
The website is a little slow because I am waiting for every item to come back before rendering the page. This can be faster by rendering items on the front end as they come in via Reagent.
-
First, make sure that you have Java installed.
-
Then, install Leiningen:
$ brew install leiningen
- Finally, start up the server:
$ cd hackernews
$ lein run
The website will be up on localhost:3000.