A demo user management server written in Clojure.
- HTTP Kit minimalist, efficient, Ring-compatible HTTP server for Clojure
- mount for managing app state
- Ragtime for database migrations
- reitit for routing
- You will need Leiningen 2.0.0 or above installed.
- PostgreSQL is used for the data store.
Start the server by running:
$ lein run -m clj-admin.core
The API endpoints can now be reached at http://localhost:3000/api/v1.
PostgreSQL database setup:
$ createdb clj_admin_dev
The extension uuid-ossp
must be installed on the database as UUIDs are auto-generated with uuid_generate_v4()
for all id
columns. So after connecting to the database in psql
run:
psql=# CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
Run migrations:
$ lein migrate
Rollback migrations:
$ lein rollback
Creating migrations:
$ NOW=$(date "+%Y%m%d%H%M%S")
$ touch resources/migrations/$NOW-create-users.up.sql
$ touch resources/migrations/$NOW-create-users.down.sql
- Tests
- Exception handling
- Add authentication
- Document API with Swagger (reitit.swagger)
- Possibly add Toucan for ORM support
Copyright © 2019 Albert Chan