Skip to content

A simple service built with http4k, Kodein, and Exposed.

Notifications You must be signed in to change notification settings

vitdebacco/http4k-kodein-exposed

Repository files navigation

http4k-kodein-exposed

This project is a sample service using http4k (with Netty) and Exposed ORM. At some point it will also leverage Kodein for dependency injection. The ultimate goal is to incorporate a similar sample service into cautious-engine to test the performance of various frameworks.

This project was initialized as a new Gradle project via IntelliJ.

Build and Run

  1. docker-compose up
  2. ./gradlew run

cURL Requests (w/ jq)

Offerings

Create

To create an Offering, you must supply name, tasting_notes, description, url, and roaster_name.

curl -X POST 'http://localhost:8080/offerings' -H 'Content-Type: application/json' -d '{                                                                            130 ↵
  "name": "Ethiopia Kochere & Yirgacheffe Jabanto",
  "tasting_notes": "Blueberry, Chocolate, Honey",
  "description": "The Jabanto group formed in 2017, after changes in the Ethiopian coffee policy permitted smallholder farmers to be able to directly export and sell their coffees. The group has worked hard to build an enterprising business from scratch and their commitment to careful harvesting and processing each year results in some of our favorite offerings. This year’s production of Jabanto Natural Sundried tastes like blueberry, chocolate, and honey.",
  "url": "https://counterculturecoffee.com/shop/coffee/jabanto-natural-sundried",
  "roaster_name": "Counter Culture Coffee"
}' | jq
Get All
curl 'http://localhost:8080/offerings' | jq
Get By ID
curl 'http://localhost:8080/offerings/{id}' | jq
Update

Only description is updatable.

curl -X PUT 'http://localhost:8080/offerings/{id}' -H 'Content-Type: application/json' -d '{ "description":"Updated Description" }' | jq
Delete
curl -X DELETE 'http://localhost:8080/offerings/{id}' | jq

Ratings

Create
curl -X POST 'http://localhost:8080/offerings/61d43952-345e-4648-93d2-d148a84a6c17/ratings' -H 'Content-Type: application/json' -d '{ "value": 5, "comment":"tastes like blueberries and honey!", "offering_id":"61d43952-345e-4648-93d2-d148a84a6c17", "username":"vit" }' | jq
curl -X POST 'http://localhost:8080/offerings/61d43952-345e-4648-93d2-d148a84a6c17/ratings' -H 'Content-Type: application/json' -d '{ "value": 3, "comment":"it was better last year", "offering_id":"61d43952-345e-4648-93d2-d148a84a6c17", "username":"notvit" }' | jq
curl -X POST 'http://localhost:8080/offerings/61d43952-345e-4648-93d2-d148a84a6c17/ratings' -H 'Content-Type: application/json' -d '{ "value": 1, "comment":"this tastes like blueberry. gross", "offering_id":"61d43952-345e-4648-93d2-d148a84a6c17", "username":"definitelynotvit" }' | jq
Get All
curl 'http://localhost:8080/offerings/61d43952-345e-4648-93d2-d148a84a6c17/ratings' | jq

Helpful Links

Examples and linked projects from http4k

http4k on GitHub

This example in particular: Real World App (Medium Clone)

Guide to the Kotlin Exposed Framework

About

A simple service built with http4k, Kodein, and Exposed.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages