gogs.go 944 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright 2014 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package main
  5. import (
  6. "fmt"
  7. "net/http"
  8. "github.com/codegangsta/martini"
  9. "github.com/martini-contrib/render"
  10. "github.com/gogits/gogs/routers"
  11. "github.com/gogits/gogs/routers/user"
  12. "github.com/gogits/gogs/utils"
  13. "github.com/gogits/gogs/utils/log"
  14. )
  15. const APP_VER = "0.0.0.0217"
  16. func init() {
  17. }
  18. func main() {
  19. log.Info("%s %s", utils.Cfg.MustValue("", "APP_NAME"), APP_VER)
  20. m := martini.Classic()
  21. // Middleware.
  22. m.Use(render.Renderer())
  23. // Routers.
  24. m.Get("/", routers.Dashboard)
  25. m.Get("/user/signin", user.SignIn)
  26. m.Any("/user/signup", user.SignUp)
  27. listenAddr := fmt.Sprintf("%s:%s",
  28. utils.Cfg.MustValue("server", "HTTP_ADDR"),
  29. utils.Cfg.MustValue("server", "HTTP_PORT", "3000"))
  30. log.Info("Listen: %s", listenAddr)
  31. http.ListenAndServe(listenAddr, m)
  32. }