initial main file.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu 2016-03-24 17:01:43 +08:00
parent 4a907383a0
commit 199e5b0cfb
1 changed files with 30 additions and 0 deletions

30
main.go Normal file
View File

@ -0,0 +1,30 @@
package main
import (
"net/http"
"github.com/gin-gonic/gin"
api "github.com/appleboy/gin-status-api"
)
func rootHandler(context *gin.Context) {
context.JSON(http.StatusOK, gin.H{
"text": "hello world",
})
}
func GetMainEngine() *gin.Engine {
r := gin.New()
// Global middleware
r.Use(gin.Logger())
r.Use(gin.Recovery())
r.GET("/api/status", api.StatusHandler)
r.GET("/", rootHandler)
return r
}
func main() {
GetMainEngine().Run(":8088")
}