2019-09-28 20:04:51 -04:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"github.com/codegangsta/negroni"
|
|
|
|
"github.com/jchenry/jchenry/auth"
|
|
|
|
jch_http "github.com/jchenry/jchenry/http"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
auth.Init()
|
|
|
|
StartServer()
|
|
|
|
}
|
|
|
|
|
|
|
|
func StartServer() {
|
|
|
|
auth.PrintConfig()
|
|
|
|
s := jch_http.NewServer(negroni.New()).
|
|
|
|
Static("/public/*filepath", http.Dir("public/")).
|
2019-09-29 15:30:24 -04:00
|
|
|
Service("", auth.Service(auth.FromEnv(nil))).
|
2019-09-28 20:04:51 -04:00
|
|
|
GET("/", "", http.HandlerFunc(HomeHandler))
|
|
|
|
|
|
|
|
port := os.Getenv("PORT")
|
|
|
|
if port == "" {
|
|
|
|
port = "3000"
|
|
|
|
}
|
|
|
|
|
|
|
|
s.Run(":" + port)
|
|
|
|
}
|
|
|
|
|
|
|
|
func HomeHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
jch_http.RenderTemplate(w, "home", nil)
|
|
|
|
}
|