Add HomeController and initial application setup with routing
This commit is contained in:
@@ -28,10 +28,11 @@ lazy val commonSettings = Seq(
|
|||||||
|
|
||||||
lazy val knockoutwhist = project.in(file("knockoutwhist"))
|
lazy val knockoutwhist = project.in(file("knockoutwhist"))
|
||||||
.settings(
|
.settings(
|
||||||
commonSettings
|
commonSettings,
|
||||||
|
mainClass := Some("de.knockoutwhist.KnockOutWhist")
|
||||||
)
|
)
|
||||||
|
|
||||||
lazy val knockoutwhistWeb = project.in(file("knockoutwhist-web"))
|
lazy val knockoutwhistweb = project.in(file("knockoutwhistweb"))
|
||||||
.enablePlugins(PlayScala)
|
.enablePlugins(PlayScala)
|
||||||
.dependsOn(knockoutwhist % "compile->compile;test->test")
|
.dependsOn(knockoutwhist % "compile->compile;test->test")
|
||||||
.settings(
|
.settings(
|
||||||
@@ -40,7 +41,7 @@ lazy val knockoutwhistWeb = project.in(file("knockoutwhist-web"))
|
|||||||
)
|
)
|
||||||
|
|
||||||
lazy val root = (project in file("."))
|
lazy val root = (project in file("."))
|
||||||
.aggregate(knockoutwhist, knockoutwhistWeb)
|
.aggregate(knockoutwhist, knockoutwhistweb)
|
||||||
.settings(
|
.settings(
|
||||||
name := "KnockOutWhistRoot"
|
name := "KnockOutWhistWeb"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
/home/janis/Workspaces/IntelliJ/knockoutwhist
|
|
||||||
@@ -12,6 +12,8 @@ import de.knockoutwhist.KnockOutWhist
|
|||||||
@Singleton
|
@Singleton
|
||||||
class HomeController @Inject()(val controllerComponents: ControllerComponents) extends BaseController {
|
class HomeController @Inject()(val controllerComponents: ControllerComponents) extends BaseController {
|
||||||
|
|
||||||
|
private var initial = false
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an Action to render an HTML page.
|
* Create an Action to render an HTML page.
|
||||||
*
|
*
|
||||||
@@ -19,7 +21,14 @@ class HomeController @Inject()(val controllerComponents: ControllerComponents) e
|
|||||||
* will be called when the application receives a `GET` request with
|
* will be called when the application receives a `GET` request with
|
||||||
* a path of `/`.
|
* a path of `/`.
|
||||||
*/
|
*/
|
||||||
def index() = Action { implicit request: Request[AnyContent] =>
|
def index() = {
|
||||||
Ok(views.html.main.render("KnockoutWhist", views.html.index.render()))
|
if (!initial) {
|
||||||
|
initial = true
|
||||||
|
KnockOutWhist.main(new Array[String](_length = 0))
|
||||||
|
}
|
||||||
|
Action { implicit request: Request[AnyContent] => {
|
||||||
|
Ok(views.html.main.render("KnockoutWhist", views.html.index.apply()))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Before Width: | Height: | Size: 687 B After Width: | Height: | Size: 687 B |
Reference in New Issue
Block a user