aboutsummaryrefslogtreecommitdiff
path: root/startpage/server.go
blob: b2eef0cac29601c53a88eb452e472d04471b88c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package main

import (
	"github.com/gin-gonic/gin"
	"net/http"
	"time"
)

func main() {
	router := gin.New()
	router.LoadHTMLGlob("/home/zt/.config/startpage/index.html")
	router.Static("main", "/home/zt/.config/startpage/")

	router.GET("/", func (c *gin.Context) {
		time := time.Now().Format("15:04 02 Jan (Monday)")
		c.HTML(http.StatusOK, "index.html", gin.H{
			"time": time,
		})
	})

	router.Run(":8081")
}