Created
October 22, 2015 15:12
-
-
Save jsloyer/51f68803020c92fc1a64 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func main() { | |
router := gin.Default() | |
router.LoadHTMLGlob("templates/*") | |
router.GET("/", func(c *gin.Context) { | |
c.HTML(http.StatusOK, "index.tmpl", gin.H{ | |
"title": "Main website", | |
}) | |
}) | |
router.GET("/hi", func(c *gin.Context) { | |
c.JSON(200, gin.H{ | |
"message": "hi", | |
}) | |
}) | |
port := os.Getenv("VCAP_APP_PORT") | |
if port == "" { | |
port = "8080" | |
} | |
router.Run(":" + port) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment