diff options
author | Jakob Odersky <jakob@driver.xyz> | 2018-10-11 14:19:28 -0700 |
---|---|---|
committer | Jakob Odersky <jakob@driver.xyz> | 2018-10-12 13:13:17 -0700 |
commit | a43556851bf986b81351fc9f1ae5ba51bf21dc47 (patch) | |
tree | b5863203cb94b510ec4e4c2c611dd15317cbd5b8 /README.md | |
parent | 03ed05c0fcb948237d66f032c4e530b2349404b9 (diff) | |
download | driver-core-a43556851bf986b81351fc9f1ae5ba51bf21dc47.tar.gz driver-core-a43556851bf986b81351fc9f1ae5ba51bf21dc47.tar.bz2 driver-core-a43556851bf986b81351fc9f1ae5ba51bf21dc47.zip |
Add an example to the README and a standalone application templateHEADv2.0.0-M5masterjo/example
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 26 |
1 files changed, 25 insertions, 1 deletions
@@ -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 |