add route for personal props app
This commit is contained in:
parent
dd740f71ea
commit
7dd0d74b12
16
approutes/personalPropsRoute/personalPropsRoute.go
Normal file
16
approutes/personalPropsRoute/personalPropsRoute.go
Normal 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})
|
||||
})
|
||||
}
|
7
main.go
7
main.go
@ -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)
|
||||
|
39
websiteapp/personalprops/personalprops.go
Normal file
39
websiteapp/personalprops/personalprops.go
Normal 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
|
||||
}
|
Loading…
Reference in New Issue
Block a user