aboutsummaryrefslogtreecommitdiff
path: root/startpage/server.go
diff options
context:
space:
mode:
authorVidhu Kant Sharma <bokuwakanojogahoshii@yahoo.com>2021-02-05 21:01:24 +0530
committerVidhu Kant Sharma <bokuwakanojogahoshii@yahoo.com>2021-02-05 21:01:24 +0530
commit2b302678650520750863ae19f7a940219646225c (patch)
tree721a18bd6efd44bee7998690ea3fe8ceee9b2f43 /startpage/server.go
parent866d9c1b2f04eaa7c81ca65419ebcafe93540d4f (diff)
coded a server to serve the startpage locally
Diffstat (limited to 'startpage/server.go')
-rw-r--r--startpage/server.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/startpage/server.go b/startpage/server.go
new file mode 100644
index 00000000..b2eef0ca
--- /dev/null
+++ b/startpage/server.go
@@ -0,0 +1,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")
+}