|
- package main
-
- import (
- "log"
- "net/http"
- )
-
- //PathsConfig all system available pathes
- type PathsConfig struct {
- CRMAttachment string `json:"crm_attachmeng"`
- }
-
- //GlobalPath all global pathes configurations
- var GlobalPath = PathsConfig{"/tmp/"}
-
- func main() {
- err := readConfig() //wechat API config
- if err != nil {
- log.Println(err)
- log.Fatal("unable to read server_config.json, program quit")
- return
- }
-
- err = readCRMConfig()
- if err != nil {
- log.Println(err)
- log.Fatal("unable to read crm_config.json, program quit")
- }
-
- //fs := http.FileServer(http.Dir("/mnt/data/workspace/angular.ts/ng2-admin/dist"))
- fs := http.FileServer(http.Dir("/mnt/data/workspace/angular.ts/wechat/ng2-admin/dist"))
- //http.Handle("/test", http.StripPrefix("/test", fs))
- http.Handle("/", fs)
- //setup handler
- //http.HandleFunc("/", webrootHandler)
- http.HandleFunc("/api", apiV1Main)
- http.HandleFunc("/upload", uploadHandler)
- http.HandleFunc("/crmfiles/", crmAttachmentHandler)
- http.ListenAndServe(":65500", nil)
- }
|