Lately I’ve been playing around with Datomic, a database invented by Rich Hickey, the creator of Clojure.
Datomic feels like a natural extension of Clojure’s immutable, persistent datastructures. From Datomic’s architecture documentation:
A Datomic database stores a collection of facts. The facts in a database are immutable; once stored, they do not change. However, old facts can be superseded by new facts over time. The state of the database is a value defined by the set of facts in effect at a given moment in time.
The Problem with Asynchronicity
When we use Promises, our code structure is flattened, and our error handling code can be …continue.
I’ve found that most Clojure web application articles out there cover the Ring and Compojure APIs pretty well, but stop short of the data access layer, leaving that up to you. This article will attempt to remedy that, with a focus on relational databases.
In this post we’ll create a simple RESTAPI for a todo list web application. We’ll use Compojure to create a RESTAPI, Lobos to create and manage our database tables, and Korma to query a PostgreSQL database.