Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

todo-api

Todo API, an example REST API based on Duct.

Prerequisites

Development

Setup

When you first clone this repository, run:

$ lein duct setup

This will create files for local configuration, and prep your system for the project.

Start and migrate database

# Start local DB
$ docker-compose up -d
# Migrate local DB
$ lein db-migrate dev

Run

To begin developing, start with a REPL.

$ lein repl

Then load the development environment.

user=> (dev)
:loaded

Run go to prep and initiate the system.

dev=> (go)
:duct.server.http.jetty/starting-server {:port 3000}
:initiated

By default this creates a API server at http://localhost:3000.

When you make changes to your source files, use reset to reload any modified files and reset the server.

dev=> (reset)
:reloading (...)
:resumed

Production

Build

$ lein uberjar

Migrate database

$ DATABASE_URL='jdbc:postgresql://localhost:5432/todo?user=dev&password=pass' java -jar target/todo-api.jar :duct/migrator

Run

$ PORT=3000 DATABASE_URL='jdbc:postgresql://localhost:5432/todo?user=dev&password=pass' java -jar target/todo-api.jar