Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

41 lines
1014B

  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.HandleFunc("/crmfiles/", crmAttachmentHandler)
  33. http.ListenAndServe(":65500", nil)
  34. }