Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

40 lines
961B

  1. package main
  2. import (
  3. "log"
  4. "net/http"
  5. )
  6. //PathsConfig all system available pathes
  7. type PathsConfig struct {
  8. CRMAttachment string `json:"crm_attachmeng"`
  9. }
  10. //GlobalPath all global pathes configurations
  11. var GlobalPath = PathsConfig{"/tmp/"}
  12. func main() {
  13. err := readConfig() //wechat API config
  14. if err != nil {
  15. log.Println(err)
  16. log.Fatal("unable to read server_config.json, program quit")
  17. return
  18. }
  19. err = readCRMConfig()
  20. if err != nil {
  21. log.Println(err)
  22. log.Fatal("unable to read crm_config.json, program quit")
  23. }
  24. //fs := http.FileServer(http.Dir("/mnt/data/workspace/angular.ts/ng2-admin/dist"))
  25. fs := http.FileServer(http.Dir("/mnt/data/workspace/angular.ts/wechat/ng2-admin/dist"))
  26. //http.Handle("/test", http.StripPrefix("/test", fs))
  27. http.Handle("/", fs)
  28. //setup handler
  29. //http.HandleFunc("/", webrootHandler)
  30. http.HandleFunc("/api", apiV1Main)
  31. http.HandleFunc("/upload", uploadHandler)
  32. http.ListenAndServe(":65500", nil)
  33. }