Last active
August 29, 2015 14:19
-
-
Save seratch/78bea2aa27017beca01a to your computer and use it in GitHub Desktop.
SkinnyApiServlet on http4s 0.6.5
This file contains hidden or 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
| lazy val http4sVersion = "0.6.5" | |
| lazy val skinnyVersion = "1.3.16" | |
| lazy val root = (project in file(".")).settings( | |
| scalaVersion := "2.11.6", | |
| resolvers += "Scalaz Bintray Repo" at "http://dl.bintray.com/scalaz/releases", | |
| scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature"), | |
| libraryDependencies ++= Seq( | |
| "org.skinny-framework" %% "skinny-framework" % skinnyVersion, | |
| "org.http4s" %% "http4s-dsl" % http4sVersion, | |
| "org.http4s" %% "http4s-servlet" % http4sVersion, | |
| "org.http4s" %% "http4s-jetty" % http4sVersion, | |
| "ch.qos.logback" % "logback-classic" % "1.1.3" | |
| ) | |
| ).settings(scalariformSettings: _*) |
This file contains hidden or 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
| sbt.version=0.13.8 |
This file contains hidden or 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
| scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature") | |
| addSbtPlugin("com.typesafe.sbt" % "sbt-scalariform" % "1.3.0") |
This file contains hidden or 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
| <?xml version="1.0" encoding="UTF-8" ?> | |
| <configuration> | |
| <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> | |
| <encoder> | |
| <pattern>%date %level [%thread] %logger{10} [%file:%line] %msg%n</pattern> | |
| </encoder> | |
| </appender> | |
| <root> | |
| <level value="info"/> | |
| <appender-ref ref="console"/> | |
| </root> | |
| </configuration> |
This file contains hidden or 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 skinny._ | |
| trait Controller extends SkinnyApiServlet { | |
| def index = responseAsJSON(Map("message" -> "hello")) | |
| } | |
| trait RoutesDef extends Routes { self: Controller => | |
| get("/")(index).as('index) | |
| } | |
| object SkinnyOnHttp4s extends App { | |
| import org.http4s.server.jetty.JettyBuilder | |
| JettyBuilder | |
| .bindHttp(8080) | |
| .mountServlet(new Controller with RoutesDef, "/*") | |
| .run | |
| .awaitShutdown() | |
| } |
Author
seratch
commented
Apr 25, 2015
- SkinnyController doesn't work for now because actually it's a servlet Filter.
- Is it possible to create an adapter which enables servlet Filter to work as a HttpService?
- SkinnyServlet doesn't work for now because it accesses Servlet SessionManager.
- Not sure what are changed in http4s 0.7
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment