This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GET /user/1 HTTP/1.1 | |
Accept: application/vnd.company.app.user-v2+json | |
HTTP/1.1 200 OK | |
Content-Type: application/vnd.company.app.user-v2+json | |
{"user": | |
{"email":"bob@gmail.com"} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.json4s.{DefaultFormats, Formats} | |
object Json4sProtocol extends Json4sSupport { | |
implicit def json4sFormats: Formats = DefaultFormats | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Foo Version Media Types for v1 and v2 | |
*/ | |
object VersionMediaTypes{ | |
lazy val `application/vnd.ww.v2.foo+json` = | |
MediaTypes.register(MediaType.custom("application/vnd.ww.v2.foo+json")) | |
lazy val `application/vnd.ww.v1.foo+json` = | |
MediaTypes.register(MediaType.custom("application/vnd.ww.v1.foo+json")) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* FooProtocol v1 | |
*/ | |
object FooProtocol { | |
sealed trait FooActorMessage | |
case class HelloFoo(hi: String) extends FooActorMessage | |
case class FooResponse(helloBackTo: String) extends FooActorMessage | |
import Json4sProtocol._ | |
import org.json4s.native.Serialization.{read,write => swrite} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* FooProtocol v2 | |
*/ | |
object FooProtocolV2 { | |
sealed trait FooActorMessage | |
case class HelloFoo(hi: String, there:String) extends FooActorMessage | |
case class FooResponse(helloBackTo: String) extends FooActorMessage | |
import examples.Json4sProtocol._ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Foo restful interface. | |
*/ | |
trait FooRoute extends HttpService with AskSupport { | |
import examples.FooProtocol._ | |
import examples.FooProtocolV2._ | |
implicit val timeout: Timeout | |
implicit val fooActorPath: ActorPath |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import akka.http.marshalling._ | |
import akka.http.model._ | |
import akka.http.unmarshalling.{FromResponseUnmarshaller, FromRequestUnmarshaller, Unmarshaller} | |
import akka.stream.FlowMaterializer | |
import upickle.{Writer, Reader} | |
import scala.concurrent.duration._ | |
import scala.concurrent.{ExecutionContext, Future} | |
import scala.language.implicitConversions | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version = "1.0.0" | |
name = "singlemicro" | |
system = "singlemicro-1.0.0" | |
nrOfCpus = 1.0 | |
memory = 67108864 | |
diskSpace = 5000000 | |
roles = ["backend"] | |
components = { | |
"singlemicro-1.0.0" = { | |
description = "singlemicro" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enablePlugins(JavaAppPackaging,ConductRPlugin) | |
BundleKeys.nrOfCpus := 1.0 | |
BundleKeys.memory := 10.MiB | |
BundleKeys.diskSpace := 5.MB | |
BundleKeys.endpoints := Map("singlemicro" -> Endpoint("http",0,services = Set(URI("http:/singlemicro")))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
akka.remote { | |
netty.tcp { | |
hostname = "127.0.0.1" | |
port = 8089 | |
} | |
} |