aboutsummaryrefslogtreecommitdiff
path: root/documentation/example/src/main/scala/example/Main.scala
blob: 2548f79c7b75a57c71030512a465c37804504f12 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package example

import xyz.driver.core.init

object Main extends init.SimpleHttpApp {

  lazy val fs = this.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))
      }
    }
  }

}