From b7635a1ac0b189b06a00645fb0f36ce972b02f4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Pelletier?= Date: Sat, 31 Aug 2024 22:34:44 -0400 Subject: [PATCH] Ajout index --- app/controllers/HomeController.scala | 24 ++++++++++++++++++++++++ app/views/index.scala.html | 5 +++++ conf/routes | 1 + 3 files changed, 30 insertions(+) create mode 100644 app/controllers/HomeController.scala create mode 100644 app/views/index.scala.html diff --git a/app/controllers/HomeController.scala b/app/controllers/HomeController.scala new file mode 100644 index 0000000..58c5a34 --- /dev/null +++ b/app/controllers/HomeController.scala @@ -0,0 +1,24 @@ +package controllers + +import play.api.mvc._ + +import javax.inject._ + +/** + * This controller creates an `Action` to handle HTTP requests to the + * application's home page. + */ +@Singleton +class HomeController @Inject()(val controllerComponents: ControllerComponents) extends BaseController { + + /** + * Create an Action to render an HTML page. + * + * The configuration in the `routes` file means that this method + * will be called when the application receives a `GET` request with + * a path of `/`. + */ + def index(): Action[AnyContent] = Action { implicit request: Request[AnyContent] => + Ok(views.html.index()) + } +} \ No newline at end of file diff --git a/app/views/index.scala.html b/app/views/index.scala.html new file mode 100644 index 0000000..afd0746 --- /dev/null +++ b/app/views/index.scala.html @@ -0,0 +1,5 @@ +@() + +@main("Welcome to Play") { +

Welcome to Play

+} diff --git a/conf/routes b/conf/routes index ec37fe3..4bd70ea 100644 --- a/conf/routes +++ b/conf/routes @@ -1,3 +1,4 @@ +GET / controllers.HomeController.index() GET /game controllers.GameController.index() GET /bricks controllers.GameController.getBricks()