Skip to content

Instantly share code, notes, and snippets.

@jsloyer
Created October 22, 2015 15:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsloyer/51f68803020c92fc1a64 to your computer and use it in GitHub Desktop.
Save jsloyer/51f68803020c92fc1a64 to your computer and use it in GitHub Desktop.
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