diff options
author | Unknown <joe2010xtmf@163.com> | 2014-02-12 14:54:09 -0500 |
---|---|---|
committer | Unknown <joe2010xtmf@163.com> | 2014-02-12 14:54:09 -0500 |
commit | 96b317d3fff3884dd08061d84e11a49495f83a4b (patch) | |
tree | 168e4c6168293ea1622a0c6361e36d54102af70d /gogs.go | |
parent | 4836fea8767c38f175f59f8f66579e76fe6354f5 (diff) |
Init commit
Diffstat (limited to 'gogs.go')
-rw-r--r-- | gogs.go | 26 |
1 files changed, 24 insertions, 2 deletions
@@ -5,15 +5,37 @@ package main import ( + "fmt" + "net/http" + "github.com/codegangsta/martini" + "github.com/martini-contrib/render" "github.com/gogits/gogs/routers" + "github.com/gogits/gogs/utils" + "github.com/gogits/gogs/utils/log" ) const APP_VER = "0.0.0.0212" +func init() { + +} + func main() { + log.Info("App Name: %s", utils.Cfg.MustValue("", "APP_NAME")) + m := martini.Classic() - m.Get("/", routers.HomeGet) - m.Run() + + // Middleware. + m.Use(render.Renderer()) + + // Routers. + m.Get("/", routers.Home) + + listenAddr := fmt.Sprintf("%s:%s", + utils.Cfg.MustValue("server", "HTTP_ADDR"), + utils.Cfg.MustValue("server", "HTTP_PORT", "3000")) + log.Info("Listen: %s", listenAddr) + http.ListenAndServe(listenAddr, m) } |