瀏覽代碼

added single page application path.

master
Patrick Peng Sun 8 年之前
父節點
當前提交
d29312983b
共有 1 個文件被更改,包括 9 次插入5 次删除
  1. +9
    -5
      main.go

+ 9
- 5
main.go 查看文件

@@ -12,13 +12,16 @@ import (

//PathsConfig all system available pathes
type PathsConfig struct {
Angular2App string `json:"angular2_app"`
Angular2App string `json:"angular2_app"`
SinglePageEdit string `json:"singlePageEdit"`
}

//TODO: setup GlobalPath Config, from reading file
//GlobalPath all global pathes configurations
// TODO: setup GlobalPath Config, from reading file
var GlobalPath = PathsConfig{
"/mnt/data/workspace/angular.ts/wechat/ng2-admin/dist/"}
"dist/",
"/mnt/data/workspace/go/src/wechat_hitxy/spa/",
}

//KFUsers info cache about current customer service
var KFUsers kfCache
@@ -65,6 +68,7 @@ func setupHTTPHandler() {
http.HandleFunc("/iapi/createWechatQr", iapiCreateWechatQrCode)
http.HandleFunc("/crmpixel.png", crmpixel) //tracking pixel.
http.HandleFunc("/crmcache", crmcache)
http.HandleFunc("/spa/editprofile", spaEditProfile)
http.ListenAndServe(":65500", nil)
}

@@ -79,8 +83,8 @@ func setupRootFileServer() {
http.ServeFile(w, r, GlobalPath.Angular2App+r.URL.Path[1:])
})

//fs := http.FileServer(http.Dir("/mnt/data/workspace/angular.ts/ng2-admin/dist"))
//http.Handle("/test", http.StripPrefix("/test", fs))
fs := http.FileServer(http.Dir(GlobalPath.SinglePageEdit))
http.Handle("/spa/", http.StripPrefix("/spa", fs))

//fs := http.FileServer(http.Dir("/mnt/data/workspace/angular.ts/wechat/ng2-admin/dist"))
//http.Handle("/", fs)

Loading…
取消
儲存