aboutsummaryrefslogtreecommitdiff
path: root/gogs.go
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-02-12 14:54:09 -0500
committerUnknown <joe2010xtmf@163.com>2014-02-12 14:54:09 -0500
commit96b317d3fff3884dd08061d84e11a49495f83a4b (patch)
tree168e4c6168293ea1622a0c6361e36d54102af70d /gogs.go
parent4836fea8767c38f175f59f8f66579e76fe6354f5 (diff)
Init commit
Diffstat (limited to 'gogs.go')
-rw-r--r--gogs.go26
1 files changed, 24 insertions, 2 deletions
diff --git a/gogs.go b/gogs.go
index 8a4b9e00..c0b11fb8 100644
--- a/gogs.go
+++ b/gogs.go
@@ -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)
}