feat: add basic template

This commit is contained in:
Yanislav Igonin 2021-08-28 17:34:58 +03:00
parent 6b72e3f843
commit 157a8108d5
4 changed files with 30 additions and 2 deletions

4
.gitignore vendored
View File

@ -15,4 +15,6 @@
# vendor/
.vscode/
tmp/
tmp/
micrach

View File

@ -7,7 +7,7 @@ import (
)
func GetThreads(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"route": "get threads"})
c.HTML(http.StatusOK, "index.html", nil)
}
func GetThread(c *gin.Context) {

View File

@ -20,6 +20,7 @@ func main() {
gin.SetMode(Config.App.Env)
router := gin.Default()
router.LoadHTMLGlob("templates/*.html")
router.GET("/", Controllers.GetThreads)
router.POST("/", Controllers.CreateThread)
router.GET("/:threadId", Controllers.GetThread)

25
templates/index.html Normal file
View File

@ -0,0 +1,25 @@
<html lang="en">
<head>
<meta charset="UTF-8"/>
<title>Micrach</title>
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-KyZXEAg3QhqLMpG8r+8fhAXLRk2vvoC2f3B09zVXn8CA5QIVfZOJ3BCsw2P0p/We"
crossorigin="anonymous"
>
<script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/js/bootstrap.bundle.min.js"
integrity="sha384-U1DAWAznBHeqEIlVSCgzq+c9gqGAJn5c/t99JyeKa9xxaYpSvHU5awsuZVVFIhvj"
crossorigin="anonymous">
</script>
</head>
<body>
<div>
INDEX
</div>
</body>
</html>