add route for personal props app

This commit is contained in:
cyber-dream 2023-03-15 15:32:41 +03:00
parent dd740f71ea
commit 7dd0d74b12
3 changed files with 61 additions and 1 deletions

View File

@ -0,0 +1,16 @@
package personalpropsroute
import (
"net/http"
"personalwebsite/websiteapp/personalprops"
"github.com/gin-gonic/gin"
)
func Route(route *gin.RouterGroup) {
persPropsApp := personalprops.NewPersPropsApp()
route.GET("/test", func(ctx *gin.Context) {
test := persPropsApp.Render()
ctx.HTML(http.StatusOK, "personal-properties.html", gin.H{"books": test})
})
}

View File

@ -3,6 +3,7 @@ package main
import (
"log"
"net/http"
personalpropsroute "personalwebsite/approutes/personalPropsRoute"
"github.com/gin-gonic/gin"
)
@ -17,8 +18,12 @@ func main() {
router.Static("/res", "resources")
router.GET("/", index)
router.GET("/getmockapp", func(ctx *gin.Context) {
ctx.HTML(http.StatusOK, "mockapp.html", nil)
})
apps := router.Group("applications")
{
personalpropsroute.Route(apps.Group("/personalproperties"))
}
// router.GET("/room/:roomid", roomGET)
// router.POST("/room-post/:roomid", roomPOST)
// router.GET("/stream/:roomid", streamRoom)

View File

@ -0,0 +1,39 @@
package personalprops
type PersonalPropertiesApp struct {
}
func NewPersPropsApp() PersonalPropertiesApp {
newApp := PersonalPropertiesApp{}
return newApp
}
func (p *PersonalPropertiesApp) Render() []Book {
books := make([]Book, 0)
books = append(books, Book{
Title: "About person:",
Author: "General information about me",
})
books = append(books, Book{
Title: "Career:",
Author: "Inforamtion about my career",
})
books = append(books, Book{
Title: "TEST:",
Author: "QQQQQQQ",
})
books = append(books, Book{
Title: "TEST:",
Author: "QQQQQQQ",
})
books = append(books, Book{
Title: "TEST:",
Author: "QQQQQQQ",
})
return books
}
type Book struct {
Title string
Author string
}