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"))
|
||||
.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)
|
||||
.dependsOn(knockoutwhist % "compile->compile;test->test")
|
||||
.settings(
|
||||
@@ -40,7 +41,7 @@ lazy val knockoutwhistWeb = project.in(file("knockoutwhist-web"))
|
||||
)
|
||||
|
||||
lazy val root = (project in file("."))
|
||||
.aggregate(knockoutwhist, knockoutwhistWeb)
|
||||
.aggregate(knockoutwhist, knockoutwhistweb)
|
||||
.settings(
|
||||
name := "KnockOutWhistRoot"
|
||||
name := "KnockOutWhistWeb"
|
||||
)
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
/home/janis/Workspaces/IntelliJ/knockoutwhist
|
||||
@@ -12,6 +12,8 @@ import de.knockoutwhist.KnockOutWhist
|
||||
@Singleton
|
||||
class HomeController @Inject()(val controllerComponents: ControllerComponents) extends BaseController {
|
||||
|
||||
private var initial = false
|
||||
|
||||
/**
|
||||
* 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
|
||||
* a path of `/`.
|
||||
*/
|
||||
def index() = Action { implicit request: Request[AnyContent] =>
|
||||
Ok(views.html.main.render("KnockoutWhist", views.html.index.render()))
|
||||
def index() = {
|
||||
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