diff options
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -0,0 +1,30 @@ +package main + +import ( +// "log" + "net/http" + "os" + + "github.com/gin-gonic/gin" + _ "github.com/heroku/x/hmetrics/onload" +) + +func main() { + port := os.Getenv("PORT") + + if port == "" { + // log.Fatal("$PORT must be set") + port = "8080" + } + + router := gin.New() + router.Use(gin.Logger()) + router.LoadHTMLGlob("templates/*.html") + router.Static("/static", "static") + + router.GET("/", func(c *gin.Context) { + c.HTML(http.StatusOK, "index.html", nil) + }) + + router.Run(":" + port) +} |