Example of using clojure-clr and dotnet 7 minimal api 100% async - interoping with System.Threading.Tasks.Task using clojure core.async.
- build the image:
docker build -t clojure-clr-api .
- docker-compose up (launches postgres and the application)
- Install .NET 7 and Docker
- Install potion - a clojure clr tool as a tool:
dotnet tool install --global potion
-- must be version 1.0.5+ - Run
dotnet restore
to install the nuget packages specified inCljApi.csproj
- docker-compose up using the docker-compose in /dev
From the terminal:
- start a clojure nrepl:
potion repl
- connect with a nrepl compatible editor, e.g. VSCode using the Calva extension.
- Eval code via the repl 💠 -
main.cljr
contains a comment block where you can start and stop the application via the repl.
potion -m clj-api.main
GET - /
GET - /users
- returns all users
POST - /user
- create a user
GET - /healthz
- returns health check status
- System composition using integrant ✅
- Routing ✅
- Db Access ✅
- Add routes that accepts json, returns json ✅
- Health Checks ✅
- Structured Logging with Serilog ✅
- Background jobs
- Metrics
- Swagger Docs
- Request Validation
- CI - build a Docker image from a Dockerfile
- Can't produce a standalone DLL with clojure-clr for .NET Core 3.1+