Last active
October 8, 2017 09:45
-
-
Save seratch/3a69f48b90daa68f04459237eb99fcf5 to your computer and use it in GitHub Desktop.
Skinny Micro on GAE
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
package example | |
import scala.concurrent._ | |
import skinny.micro._ | |
object App extends AsyncWebApp { | |
error { | |
case e => | |
logger.error(e.getMessage, e) | |
throw e // re-throwing the exception keeps the response as status 500 | |
} | |
get("/echo") { implicit ctx => | |
params.get("message") match { | |
case Some(msg) => msg | |
case _ => "" | |
} | |
} | |
} |
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"?> | |
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0"> | |
<application>{your own application id here}</application><!-- unused for Cloud SDK based tooling --> | |
<version>alpha-001</version><!-- unused for Cloud SDK based tooling --> | |
<runtime>java8</runtime> | |
<threadsafe>true</threadsafe> | |
</appengine-web-app> |
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 javax.servlet._ | |
import skinny.micro._ | |
class Bootstrap extends LifeCycle { | |
override def init(ctx: ServletContext) { | |
example.App.mount(ctx) | |
} | |
} |
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.15 |
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 root = (project in file(".")) | |
.settings( | |
organization := "org.skinny-framework", | |
name := "skinny-micro-usage-example", | |
version := "0.1", | |
scalaVersion := "2.12.2", | |
libraryDependencies ++= Seq( | |
"org.skinny-framework" %% "skinny-micro" % skinnyMicroVersion % Compile, | |
"org.skinny-framework" %% "skinny-micro-jackson" % skinnyMicroVersion % Compile, | |
"org.skinny-framework" %% "skinny-micro-scalate" % skinnyMicroVersion % Compile, | |
"ch.qos.logback" % "logback-classic" % "1.2.3" % Compile, | |
"javax.servlet" % "javax.servlet-api" % "3.1.0" % "container;provided;test", | |
"org.mortbay.jetty" % "jetty" % "6.1.22" % "container" | |
), | |
scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature") | |
) | |
.enablePlugins(AppenginePlugin) | |
lazy val skinnyMicroVersion = "1.2.+" |
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("io.get-coursier" % "sbt-coursier" % "1.0.0-RC6") | |
addSbtPlugin("com.eed3si9n" % "sbt-appengine" % "0.7.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
├── build.sbt | |
├── project | |
│ ├── build.properties | |
│ └── plugins.sbt | |
├── src | |
│ └── main | |
│ ├── scala | |
│ │ ├── Bootstrap.scala | |
│ │ └── app.scala | |
│ └── webapp | |
│ └── WEB-INF | |
│ ├── appengine-web.xml | |
│ └── web.xml | |
└── target |
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"?> | |
<web-app xmlns="http://java.sun.com/xml/ns/javaee" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_1.xsd" | |
version="3.1"> | |
<listener> | |
<listener-class>skinny.micro.SkinnyListener</listener-class> | |
</listener> | |
</web-app> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment