Skip to content

This demonstrates a project with two endpoints and middleware common to both

Notifications You must be signed in to change notification settings

danielsz/system-duct-style-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multiple endpoints example with system

Definition

This is an example for the system library. It shows how to leverage the Duct components to build an application with multiple endpoints.

Mission statement

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.

Installation

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

Usage

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.

About

This demonstrates a project with two endpoints and middleware common to both

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published