Commit aca59d1b authored by gaoshiyao's avatar gaoshiyao

更新路由设置

parent e3d44b8b
...@@ -2,7 +2,6 @@ package handler ...@@ -2,7 +2,6 @@ package handler
import ( import (
"fmt" "fmt"
"github.com/sirupsen/logrus"
"net/http" "net/http"
"strings" "strings"
...@@ -30,7 +29,6 @@ func CreateProxyHandler() (*ProxyHandler, error) { ...@@ -30,7 +29,6 @@ func CreateProxyHandler() (*ProxyHandler, error) {
var ch chan bool var ch chan bool
func (handler *ProxyHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) { func (handler *ProxyHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
logrus.Info("===>", req.URL)
if err := count(); err != nil { if err := count(); err != nil {
fmt.Println(err.Error()) fmt.Println(err.Error())
w.Write([]byte("缓存计数失败!")) w.Write([]byte("缓存计数失败!"))
......
...@@ -27,6 +27,7 @@ func main() { ...@@ -27,6 +27,7 @@ func main() {
counthandler, _ := handler.CreateCountHandler() counthandler, _ := handler.CreateCountHandler()
http.Handle(fmt.Sprintf("%s%s", *argPrefix, "/count"), counthandler) http.Handle(fmt.Sprintf("%s%s", *argPrefix, "/count"), counthandler)
http.Handle(*argPrefix+"/", proxyhandler) http.Handle(*argPrefix+"/", proxyhandler)
http.Handle(os.Getenv("PROXY_PATH")+"/", proxyhandler)
logrus.Info("Listen Server on port :", *argPort) logrus.Info("Listen Server on port :", *argPort)
http.ListenAndServe(fmt.Sprintf(":%d", *argPort), nil) http.ListenAndServe(fmt.Sprintf(":%d", *argPort), nil)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment