|
@@ -1,46 +0,0 @@
|
|
|
-//
|
|
|
-
|
|
|
-
|
|
|
-package main
|
|
|
-
|
|
|
-import (
|
|
|
- "log"
|
|
|
- "net/http"
|
|
|
- "net/http/httputil"
|
|
|
- "net/url"
|
|
|
- "os"
|
|
|
-
|
|
|
- "github.com/gohxs/prettylog"
|
|
|
- "github.com/gohxs/webu"
|
|
|
-)
|
|
|
-
|
|
|
-func main() {
|
|
|
- prettylog.Global()
|
|
|
-
|
|
|
- mux := http.NewServeMux()
|
|
|
-
|
|
|
- var assetHandler http.Handler
|
|
|
- if os.Getenv("DEBUG") == "1" {
|
|
|
- //log.Println("DEBUG MODE: reverse proxy localhost:8081")
|
|
|
- proxyURL, err := url.Parse("http://localhost:8080")
|
|
|
- if err != nil {
|
|
|
- log.Fatal(err)
|
|
|
- }
|
|
|
-
|
|
|
- rp := httputil.NewSingleHostReverseProxy(proxyURL)
|
|
|
- rp.ErrorLog = prettylog.New("rproxy")
|
|
|
- assetHandler = rp
|
|
|
- } else {
|
|
|
- // Check folder web?
|
|
|
- assetHandler = webu.StaticHandler("web", "index.html")
|
|
|
- //staticHandler = flowuiassets.AssetHandleFunc
|
|
|
- }
|
|
|
-
|
|
|
- // Reverse proxy
|
|
|
- //
|
|
|
- mux.Handle("/", assetHandler)
|
|
|
-
|
|
|
- log.Println("Listening at port: :2000")
|
|
|
-
|
|
|
- http.ListenAndServe(":2000", mux)
|
|
|
-}
|