|
@@ -2,14 +2,14 @@ package main
|
2
|
2
|
|
3
|
3
|
import (
|
4
|
4
|
"fmt"
|
5
|
|
- "html/template"
|
6
|
|
- "log"
|
7
|
5
|
"net/http"
|
8
|
6
|
"os"
|
9
|
7
|
|
10
|
8
|
"github.com/gorilla/mux"
|
|
9
|
+ "github.com/isomorphicgo/isogoapp/handlers"
|
11
|
10
|
)
|
12
|
11
|
|
|
12
|
+<<<<<<< HEAD
|
13
|
13
|
var webappRoot string = os.Getenv("ISOGO_APP_ROOT")
|
14
|
14
|
|
15
|
15
|
func indexHandler(w http.ResponseWriter, r *http.Request) {
|
|
@@ -33,19 +33,22 @@ func gopherjsScriptHandler(w http.ResponseWriter, r *http.Request) {
|
33
|
33
|
func gopherjsScriptMapHandler(w http.ResponseWriter, r *http.Request) {
|
34
|
34
|
http.ServeFile(w, r, webappRoot+"/client/client.js.map")
|
35
|
35
|
}
|
|
36
|
+=======
|
|
37
|
+var WebAppRoot string = os.Getenv("ISOGO_APP_ROOT")
|
|
38
|
+>>>>>>> 1f58dae263ab74226133033f55a2a449b05b4683
|
36
|
39
|
|
37
|
40
|
func main() {
|
38
|
41
|
|
39
|
|
- if webappRoot == "" {
|
|
42
|
+ if WebAppRoot == "" {
|
40
|
43
|
fmt.Println("The ISOGO_APP_ROOT environment variable must be set before the web server instance can be started.")
|
41
|
44
|
os.Exit(1)
|
42
|
45
|
}
|
43
|
46
|
|
44
|
|
- fs := http.FileServer(http.Dir(webappRoot + "/static"))
|
|
47
|
+ fs := http.FileServer(http.Dir(WebAppRoot + "/static"))
|
45
|
48
|
r := mux.NewRouter()
|
46
|
|
- r.HandleFunc("/", indexHandler)
|
47
|
|
- r.HandleFunc("/js/client.js", gopherjsScriptHandler)
|
48
|
|
- r.HandleFunc("/js/client.js.map", gopherjsScriptMapHandler)
|
|
49
|
+ r.HandleFunc("/", handlers.IndexHandler)
|
|
50
|
+ r.HandleFunc("/js/client.js", handlers.GopherjsScriptHandler)
|
|
51
|
+ r.HandleFunc("/js/client.js.map", handlers.GopherjsScriptMapHandler)
|
49
|
52
|
http.Handle("/", r)
|
50
|
53
|
http.Handle("/static/", http.StripPrefix("/static", fs))
|
51
|
54
|
http.ListenAndServe(":8080", nil)
|