추가중 ..
This commit is contained in:
parent
96f8d6f794
commit
02bafb4dc9
7
main.go
7
main.go
|
@ -32,11 +32,11 @@ var argPort = flag.Int("port", 8080, "port to listen")
|
||||||
var maxProcs = flag.Int("max_procs", 0, "max number of CPUs that can be used simultaneously. Less than 1 for default (number of cores).")
|
var maxProcs = flag.Int("max_procs", 0, "max number of CPUs that can be used simultaneously. Less than 1 for default (number of cores).")
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
setMaxProcs()
|
setMaxProcs()
|
||||||
r := gin.Default()
|
r := gin.Default()
|
||||||
|
|
||||||
r.Use(ginglog.Logger(3 * time.Second))
|
r.Use(ginglog.Logger(3 * time.Second))
|
||||||
|
|
||||||
r.Use(gin.Recovery())
|
r.Use(gin.Recovery())
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ func main() {
|
||||||
r.StaticFS("/static", route.Static(""))
|
r.StaticFS("/static", route.Static(""))
|
||||||
|
|
||||||
r.GET("/api", route.Api)
|
r.GET("/api", route.Api)
|
||||||
r.GET("/page", route.Page)
|
r.GET("/self", route.Self)
|
||||||
r.GET("/metric", route.Metric)
|
r.GET("/metric", route.Metric)
|
||||||
r.GET("/health", func(c *gin.Context) {
|
r.GET("/health", func(c *gin.Context) {
|
||||||
c.String(200, "OK! - mnemonics services are fully operational!")
|
c.String(200, "OK! - mnemonics services are fully operational!")
|
||||||
|
@ -58,7 +58,6 @@ func main() {
|
||||||
r.HTMLRender = util.Default()
|
r.HTMLRender = util.Default()
|
||||||
r.GET("/", route.Index)
|
r.GET("/", route.Index)
|
||||||
|
|
||||||
|
|
||||||
glog.Info("bootstrapped application")
|
glog.Info("bootstrapped application")
|
||||||
r.Run() // listen and server on 0.0.0.0:8080
|
r.Run() // listen and server on 0.0.0.0:8080
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
package model
|
|
@ -0,0 +1,4 @@
|
||||||
|
package model
|
||||||
|
|
||||||
|
|
||||||
|
inter
|
|
@ -2,7 +2,7 @@ package route
|
||||||
|
|
||||||
import "github.com/gin-gonic/gin"
|
import "github.com/gin-gonic/gin"
|
||||||
|
|
||||||
func Page(c *gin.Context) {
|
func Self(c *gin.Context) {
|
||||||
content := gin.H{"Hello": "World"}
|
content := gin.H{"Hello": "World"}
|
||||||
c.JSON(200, content)
|
c.JSON(200, content)
|
||||||
}
|
}
|
Loading…
Reference in New Issue