2014-02-12 11:49:46 -06:00
|
|
|
// Copyright 2014 The Gogs Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a MIT-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2014-02-12 13:54:09 -06:00
|
|
|
"fmt"
|
|
|
|
"net/http"
|
|
|
|
|
2014-02-12 11:49:46 -06:00
|
|
|
"github.com/codegangsta/martini"
|
2014-02-12 13:54:09 -06:00
|
|
|
"github.com/martini-contrib/render"
|
2014-02-12 11:49:46 -06:00
|
|
|
|
|
|
|
"github.com/gogits/gogs/routers"
|
2014-02-17 17:38:50 -06:00
|
|
|
"github.com/gogits/gogs/routers/user"
|
2014-02-12 13:54:09 -06:00
|
|
|
"github.com/gogits/gogs/utils"
|
|
|
|
"github.com/gogits/gogs/utils/log"
|
2014-02-12 11:49:46 -06:00
|
|
|
)
|
|
|
|
|
2014-02-18 16:31:16 -06:00
|
|
|
const APP_VER = "0.0.0.0218"
|
2014-02-12 11:49:46 -06:00
|
|
|
|
2014-02-12 13:54:09 -06:00
|
|
|
func init() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-02-12 11:49:46 -06:00
|
|
|
func main() {
|
2014-02-17 17:38:50 -06:00
|
|
|
log.Info("%s %s", utils.Cfg.MustValue("", "APP_NAME"), APP_VER)
|
2014-02-12 13:54:09 -06:00
|
|
|
|
2014-02-12 11:49:46 -06:00
|
|
|
m := martini.Classic()
|
2014-02-12 13:54:09 -06:00
|
|
|
|
|
|
|
// Middleware.
|
|
|
|
m.Use(render.Renderer())
|
|
|
|
|
|
|
|
// Routers.
|
2014-02-14 19:14:22 -06:00
|
|
|
m.Get("/", routers.Dashboard)
|
2014-02-17 17:38:50 -06:00
|
|
|
m.Get("/user/signin", user.SignIn)
|
|
|
|
m.Any("/user/signup", user.SignUp)
|
2014-02-12 13:54:09 -06:00
|
|
|
|
|
|
|
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)
|
2014-02-12 11:49:46 -06:00
|
|
|
}
|