serve templates from disk

This commit is contained in:
sm
2017-01-26 20:16:12 -08:00
parent 85296b4e1b
commit 09f4fef613
6 changed files with 92 additions and 36 deletions
+11 -6
View File
@@ -10,11 +10,6 @@ import (
)
func main() {
static := ""
if s := os.Getenv("STATIC"); s != "" {
static = s
}
port := 8000
if os.Getenv("PORT") != "" {
p, err := strconv.Atoi(os.Getenv("PORT"))
@@ -25,9 +20,19 @@ func main() {
port = p
}
static := ""
if s := os.Getenv("STATIC"); s != "" {
static = s
}
tmpl := ""
if t := os.Getenv("TEMPLATES"); t != "" {
tmpl = t
}
sm := http.NewServeMux()
web.NewServer(sm, static)
web.NewSite(sm, static, tmpl)
if err := http.ListenAndServe(fmt.Sprintf(":%d", port), sm); err != nil {
fmt.Fprintf(os.Stderr, "problem serving: %v\n", err)
os.Exit(1)