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 124547E5E9; Sun, 12 Jun 2022 12:07:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1655035650; bh=oinkT52kov0dQA/n+ZZ9NYMg10MbXoLGqeijU+CByFU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JOzxccwdTdvgG8dILK94C6bxbMY3xhgucguP8nrEe5MecPM1KwOTVggnytplVDeog DqJRQYEU9wtaMPSrK4Y7pDkSFEgg1/FGjmrunUt+9nuCScCiDizBd55sMa4CL+l8QI iHQTBARM5+UpOgs/87WmIRlD4wtcuZg/FImSJszn8f13ca5ig0ftgrLE8yimQqfhhr +Vp4CVa/uUb/Ztp7rMz56Mm0xXzhU0CASmzkwF6T5aO+NEB3FrwGABL+w7IZCeY5vv 3Yqyyg5/CMTR8gx4kV6jiwbtDNxnoGbtlziFHMPJZPy56Pby4LxkgonXaLgz5QhAjO GiN73ECooVcAA== 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 06/10] server: Load `./assets` directory for `/assets` route Date: Sun, 12 Jun 2022 12:07:16 +0000 Message-Id: <20220612120720.2750101-6-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: In order to make the static assets available via HTTP URL, create a new route for static assets. We will use it to include JavaScript and CSS files from the HTML. Signed-off-by: Alviro Iskandar Setiawan --- server.go | 1 + 1 file changed, 1 insertion(+) diff --git a/server.go b/server.go index 14ffff6..dbdd2c2 100644 --- a/server.go +++ b/server.go @@ -25,6 +25,7 @@ func main() { defer database.CloseDatabaseConnection(db) r := gin.Default() r.LoadHTMLGlob("view/*.html") + r.Static("/assets", "./assets") authRoutes := r.Group("auth") { -- Alviro Iskandar Setiawan