Skip to content

albertchan/clj-admin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

clj-admin

A demo user management server written in Clojure.

Features

  • HTTP Kit minimalist, efficient, Ring-compatible HTTP server for Clojure
  • mount for managing app state
  • Ragtime for database migrations
  • reitit for routing

Prerequisites

  • You will need Leiningen 2.0.0 or above installed.
  • PostgreSQL is used for the data store.

Running

Start the server by running:

$ lein run -m clj-admin.core

The API endpoints can now be reached at http://localhost:3000/api/v1.

Development

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

TODOs

  • Tests
  • Exception handling
  • Add authentication
  • Document API with Swagger (reitit.swagger)
  • Possibly add Toucan for ORM support

License

Copyright © 2019 Albert Chan

About

A demo user management server written in Clojure.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published