A quick start compojure-api app containing basic and token authentication using buddy
Switch branches/tags
Clone or download
JarrodCTaylor
JarrodCTaylor Version: 0.4.0 -> 0.4.1
Latest commit ea6db6d Jun 15, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/leiningen/new Update README Jun 15, 2018
.gitignore Converted project into template... Oct 6, 2016
README.md Update readme Jun 14, 2018
project.clj Version: 0.4.0 -> 0.4.1 Jun 15, 2018

README.md

authenticated-compojure-api

Everything you need to get you up and running with a compojure-api utilizing token-based authentication.

Usage

Create New Local Project From Template

Make sure you have the latest version of leiningen installed.

lein new authenticated-compojure-api <project-name>

Customize profiles.clj

The project pulls sensitive information from environment variables. Make sure to populate the file completely.

Equivalent environment variables are DATABASE_URL, USER_EMAIL, USER_PASS_KEY, AUTH_KEY.

Create the PostgreSQL database for local development

psql < script/init_database.sql

Run Migrations

Migrations are managed by migratus to begin working initially run both:

lein migratus migrate && lein with-profile test migratus migrate

Running Locally

lein run -m <project-name>.server 3000

Example create a new user

curl 'http://localhost:3000/api/v1/user' -X POST -H 'Content-Type: application/json' -d '{"email":"some@one.com","username":"someone","password":"somePassword1"}'

Running Tests

lein test

Documentation

The HTML documentation can be generated with lein doc the output will be saved in doc/api.