Skip to content
A small example project in ClojureScript. Fetches train information from rata.digitraffic.fi API and displays it.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
resources/public
src
.gitignore
README.md
css
project.clj

README.md

ClojureScript Train Radiator

A small example project in ClojureScript. Fetches train information from rata.digitraffic.fi API and displays it.

Getting started

  1. Install the Clojure build tool Leiningen.
  2. Run lein figwheel dev to start the server and a browser
  3. Wait a bit, then browse to http://localhost:3449.
  4. Change the code (browser refreshes automatically thanks to Figwheel)

Project structure

  • project.clj: the configuration file for Leiningen
  • src/cljs/clojurescript_train_radiator/: the code is here
    • events.cljs
    • subs.cljs
    • views.cljs
  • resources/public/style.css: the CSS style file

Useful documentation

  • ClojureDocs – the Clojure standard library documentation, searchable
  • re-frame – the web framework used in this project that does what React and Redux do
  • Hiccup wiki - how to generate HTML
  • cljs-time - how to handle time

Tasks

  • make the page prettier
  • make the station configurable
  • poll timetables
  • show only time table rows for this station
  • only show future events
  • collect statistics of late trains

Interactive development

Interactive development means having a REPL (command prompt) where you can interact with the code and try out things, while also running the server.

Here's how:

  1. Start an interactive clojure environment, for example:
    • run lein repl in a terminal
    • use M-x cider-jack-in-clojurescript in Emacs (after installing cider)
    • install a Clojure IDE like Cursive for IntelliJ
  2. Try out things and edit code
  3. Code is automatically refreshed thanks to Figwheel

Where to go from here?

TODO

You can’t perform that action at this time.