blob: b7f035a0bc3957cf0fd945f50c1a4abbd92aa287 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
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/*")
router.Static("/static", "static")
router.GET("/en", func(c *gin.Context) {
c.HTML(http.StatusOK, "en.index.html", nil)
})
router.GET("/jp", func(c *gin.Context) {
c.HTML(http.StatusOK, "jp.index.html", nil)
})
router.GET("/", func(c *gin.Context) {
c.HTML(http.StatusOK, "redirect.index.html", nil)
})
router.Run(":" + port)
}
|