From a43556851bf986b81351fc9f1ae5ba51bf21dc47 Mon Sep 17 00:00:00 2001 From: Jakob Odersky Date: Thu, 11 Oct 2018 14:19:28 -0700 Subject: Add an example to the README and a standalone application template --- README.md | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index ec0050a..9edbfe1 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,31 @@ libraries used are: ## Example Usage -*TODO* +The following implements a simple key-value store that uses object +storage ("buckets") when running in the cloud and a local filesystem +when running on a development machine. +```scala +import xyz.driver.core.init + +object Main extends init.SimpleHttpApp { + + lazy val fs = storage("data") + + override def applicationRoute = path("data" / Segment) { key => + post { + entity(as[Array[Byte]]) { value => + complete(fs.uploadContent(key, value)) + } + } ~ get { + rejectEmptyResponse{ + complete(fs.content(key)) + } + } + } + +} +``` +See [this example project](documentation/example) for a more details. ## Building -- cgit v1.2.3