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
| [Unit] | |
| Description=Play2 Server for <site> | |
| After=network.target | |
| [Service] | |
| Type=simple | |
| PIDFile=<app_path>/RUNNING_PID | |
| ExecStartPre=/bin/sh -c 'cd <app_path> ;/bin/rm -f RUNNING_PID' | |
| ExecStart=<app_path>/bin/appexec -J-Xms64M -J-Xmx256M -Dhttp.port=9000 -Duser.timezone=Europe/Copenhagen |
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 controllers | |
| import entities.ResultObject | |
| import helpers.HttpStatus | |
| import play.api.Logger | |
| import play.api.libs.concurrent.Execution.Implicits._ | |
| import play.api.libs.json.Json | |
| import play.api.mvc.{Controller, Request, Result} | |
| import scala.concurrent.Future |
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 entities | |
| import helpers.HttpStatus | |
| import play.api.libs.json._ | |
| final case class ResultObject(data: Any = null, message: String = "", statusCode: Int = HttpStatus.OK, timestamp: Long = System.currentTimeMillis() / 1000L) | |
| object ResultObject { | |
| implicit object ResultFormat extends Format[ResultObject] { |
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 play.api.libs.json._ | |
| package object entities { | |
| private[entities] def nullable(any: Option[Any]): JsValue = any.map(format).getOrElse(JsNull) | |
| private[entities] def format(obj: Any): JsValue = obj match { | |
| case json: JsValue => json | |
| case None | null | Left => JsNull | |
| case Some(s) => format(s) | |
| case Right(r) => format(r) |
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 utils.implicits | |
| import java.text.Normalizer | |
| import java.util.regex.Pattern | |
| import scala.annotation.tailrec | |
| import scala.language.implicitConversions | |
| object StringImplicits { |