mirror of
https://github.com/yanislav-igonin/micrach
synced 2024-12-22 22:32:33 +03:00
feat: add basic template
This commit is contained in:
parent
6b72e3f843
commit
157a8108d5
2
.gitignore
vendored
2
.gitignore
vendored
@ -16,3 +16,5 @@
|
|||||||
|
|
||||||
.vscode/
|
.vscode/
|
||||||
tmp/
|
tmp/
|
||||||
|
|
||||||
|
micrach
|
@ -7,7 +7,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func GetThreads(c *gin.Context) {
|
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) {
|
func GetThread(c *gin.Context) {
|
||||||
|
1
main.go
1
main.go
@ -20,6 +20,7 @@ func main() {
|
|||||||
gin.SetMode(Config.App.Env)
|
gin.SetMode(Config.App.Env)
|
||||||
|
|
||||||
router := gin.Default()
|
router := gin.Default()
|
||||||
|
router.LoadHTMLGlob("templates/*.html")
|
||||||
router.GET("/", Controllers.GetThreads)
|
router.GET("/", Controllers.GetThreads)
|
||||||
router.POST("/", Controllers.CreateThread)
|
router.POST("/", Controllers.CreateThread)
|
||||||
router.GET("/:threadId", Controllers.GetThread)
|
router.GET("/:threadId", Controllers.GetThread)
|
||||||
|
25
templates/index.html
Normal file
25
templates/index.html
Normal 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>
|
Loading…
Reference in New Issue
Block a user