This is an example for the system library. It shows how to leverage the Duct components to build an application with multiple endpoints.
Names are important. What names? Those behind our favorite movies and our favorite books, that’s who! So let’s save them via a web service.
In our development environment, we use a in-memory database and a web server listening on port 3025.
$ boot dev
Or, if you don’t intend to connect with a REPL to the running system, type simply:
$ boot dev-run
In our production environment, we use a persistent database and a web server listening on port 8008.
$ boot prod-run
To add a director to our database:
curl -H "Content-Type: application/edn" -X PUT -d '{:director "Nagisa Ōshima"}' http://localhost:3025/director
To list directors in our database:
curl http://localhost:3025/directors
("Nagisa Ōshima")
To add an author to our database:
curl -H "Content-Type: application/edn" -X PUT -d '{:author "Albert Camus"}' http://localhost:3025/author
To list authors in our database:
curl http://localhost:3025/authors
("Alber Camus")
Lather, rinse and repeat.