Add HTML template and implement homepage with random cat posts
This commit is contained in:
@@ -17,7 +17,11 @@ func NewMainPageHandler(appContext *internal.AppContext) *MainPageHandler {
|
||||
}
|
||||
|
||||
func (appContext *MainPageHandler) HomePageHandler(c *gin.Context) {
|
||||
c.JSON(200, gin.H{
|
||||
"YouAreOn": "HomePage",
|
||||
randomPost := appContext.AppContext.PostService.GetRandomPost()
|
||||
|
||||
c.HTML(200, "index.tmpl", gin.H{
|
||||
"DisplayName": randomPost.Account.DisplayName,
|
||||
"MediaAttachment": randomPost.Attachments[0],
|
||||
"URL": randomPost.Url,
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user