Browse Source

server: Add skeleton for a play application

scalafmt-draft
Alexis Hernandez 7 years ago
parent
commit
b3eb0d6cb7
  1. 44
      server/build.sbt
  2. 7
      server/conf/application.conf
  3. 41
      server/conf/logback.xml
  4. 1
      server/conf/messages
  5. 4
      server/conf/routes
  6. 1
      server/project/build.properties
  7. 2
      server/project/plugins.sbt

44
server/build.sbt

@ -0,0 +1,44 @@
name := "xsn-block-explorer"
organization := "com.xsn"
scalaVersion := "2.12.2"
fork in Test := true
scalacOptions ++= Seq(
// "-Xfatal-warnings",
"-unchecked",
"-deprecation",
"-feature",
"-target:jvm-1.8",
"-encoding", "UTF-8",
"-Xfuture",
"-Xlint:missing-interpolator",
"-Yno-adapted-args",
"-Ywarn-dead-code",
"-Ywarn-numeric-widen",
"-Ywarn-value-discard",
"-Ywarn-unused",
"-Ywarn-unused-import"
)
val playsonifyVersion = "1.1.0-SNAPSHOT"
lazy val root = (project in file("."))
.enablePlugins(PlayScala)
libraryDependencies ++= Seq(guice, ws)
libraryDependencies += "com.alexitc" %% "playsonify" % playsonifyVersion
libraryDependencies += "com.google.inject" % "guice" % "4.1.0"
libraryDependencies += "org.scalactic" %% "scalactic" % "3.0.4"
libraryDependencies += "org.slf4j" % "slf4j-api" % "1.7.25"
libraryDependencies += "ch.qos.logback" % "logback-core" % "1.2.3"
libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.2.3"
libraryDependencies += "org.scalatestplus.play" %% "scalatestplus-play" % "3.1.0" % Test
libraryDependencies += "com.alexitc" %% "playsonifytest" % playsonifyVersion % Test
libraryDependencies += "org.mockito" % "mockito-core" % "2.15.0" % Test

7
server/conf/application.conf

@ -0,0 +1,7 @@
# https://www.playframework.com/documentation/latest/Configuration
play.i18n.langs = ["en"]
play.filters.hosts {
allowed = ["localhost", "localhost:9000", "127.0.0.1:9000"]
}

41
server/conf/logback.xml

@ -0,0 +1,41 @@
<!-- https://www.playframework.com/documentation/latest/SettingsLogger -->
<configuration>
<conversionRule conversionWord="coloredLevel" converterClass="play.api.libs.logback.ColoredLevel" />
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>${application.home:-.}/logs/application.log</file>
<encoder>
<pattern>%date [%level] from %logger in %thread - %message%n%xException</pattern>
</encoder>
</appender>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%coloredLevel %logger{15} - %message%n%xException{10}</pattern>
</encoder>
</appender>
<appender name="ASYNCFILE" class="ch.qos.logback.classic.AsyncAppender">
<appender-ref ref="FILE" />
</appender>
<appender name="ASYNCSTDOUT" class="ch.qos.logback.classic.AsyncAppender">
<appender-ref ref="STDOUT" />
</appender>
<logger name="play" level="INFO" />
<logger name="application" level="DEBUG" />
<!-- Off these ones as they are annoying, and anyway we manage configuration ourselves -->
<logger name="com.avaje.ebean.config.PropertyMapLoader" level="OFF" />
<logger name="com.avaje.ebeaninternal.server.core.XmlConfigLoader" level="OFF" />
<logger name="com.avaje.ebeaninternal.server.lib.BackgroundThread" level="OFF" />
<logger name="com.gargoylesoftware.htmlunit.javascript" level="OFF" />
<root level="INFO">
<appender-ref ref="ASYNCFILE" />
<appender-ref ref="ASYNCSTDOUT" />
</root>
</configuration>

1
server/conf/messages

@ -0,0 +1 @@
# https://www.playframework.com/documentation/latest/ScalaI18N

4
server/conf/routes

@ -0,0 +1,4 @@
# Routes
# This file defines all application routes (Higher priority routes first)
# https://www.playframework.com/documentation/latest/ScalaRouting
# ~~~~

1
server/project/build.properties

@ -0,0 +1 @@
sbt.version=1.1.1

2
server/project/plugins.sbt

@ -0,0 +1,2 @@
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.6")
Loading…
Cancel
Save