From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NO_DNS_FOR_FROM,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from localhost.localdomain (unknown [138.197.159.143]) by gnuweeb.org (Postfix) with ESMTPSA id E9E797E5E4; Sun, 12 Jun 2022 12:07:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1655035648; bh=jye0TFrfIBkBJetHEFlFaBjnvMrYLEPYEyluabPR5C0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o2QgZglSj/5XTueIxPgaZ6L03g50m9AgH0g+Hc4Z8RBvxo5S28+J9IMEgTWaiMv/v 9dhzM3wUxNyczu/gAMBr/zhC7WWbjf7G/UTOvZtioswOp4B3e0PDAas4uGwgBWvzhD sNA+pCBWkAH8+H5B5x7eT8LFfEslLfssxJvdPCB9n68x39ZRK9g/Mbpmox0MziW9Vj 22Ev5N4mODtbIIN2tAo/hUPXkPSIGcVe1379XJ4cB4VggUyLdmd3G6JmkEyqB44M52 tXl1oXdmsp4gqbJvRGz7Tx6td2PmdSXfCWi0B4kLsbiGQobAweeK0WwHSfiTev3LVT gmE8OLr/E78ZQ== From: Alviro Iskandar Setiawan To: "Fernanda Ma'rouf" , Akiekano Cc: Alviro Iskandar Setiawan , "GNU/Weeb Mailing List" , Ammar Faizi , Ammar Alifian Fahdan , Irvan Malik Azantha , Khoiri , Muhammad Irvan Hakim Subject: [PATCH buubuu v1 05/10] controller: Crate Index() method in authController Date: Sun, 12 Jun 2022 12:07:15 +0000 Message-Id: <20220612120720.2750101-5-alviro.iskandar@gnuweeb.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: This is just a preparation to add the index page in authController. Just load the index.html from this method when we receive HTTP GET request. Nothing complex here in particular. Signed-off-by: Alviro Iskandar Setiawan --- controller/auth-controller.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/controller/auth-controller.go b/controller/auth-controller.go index 034f07e..0df276c 100644 --- a/controller/auth-controller.go +++ b/controller/auth-controller.go @@ -13,6 +13,7 @@ import ( // contract what this controller can do type AuthController interface { + Index(ctx *gin.Context) Login(ctx *gin.Context) Register(ctx *gin.Context) } @@ -30,6 +31,13 @@ func NewAuthController(authService service.AuthService, jwtService service.JWTSe } } +func (c *authController) Index(ctx *gin.Context) { + if (ctx.Request.Method == "GET") { + ctx.HTML(http.StatusOK, "index.html", gin.H{}) + return + } +} + func (c *authController) Login(ctx *gin.Context) { if (ctx.Request.Method == "GET") { -- Alviro Iskandar Setiawan