The backend for the project formerly known as signet, now known as beignet.
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

main.go 1.8 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package main
  2. import (
  3. "fmt"
  4. "github.com/gorilla/mux"
  5. "github.com/imosed/signet/data"
  6. "github.com/imosed/signet/endpoints"
  7. "github.com/spf13/viper"
  8. "net/http"
  9. )
  10. var err error
  11. // Testnet wallet: GDQZ34LBZSUYFR3DSDYFDLNYDHRXPUB76FIW2FTESYHRUOGZ6GXN5LOS
  12. // Testnet secret: SCDYZYNZIDYHU3HNIBDZEVCRD2QB2VOZWJR3XP63FA6AOC6GQQSZ3C3U
  13. // TODO: beignet.io
  14. func main() {
  15. viper.SetConfigFile("config.production.json")
  16. err = viper.ReadInConfig()
  17. if err != nil {
  18. panic("Could not read in Viper config")
  19. }
  20. data.InitializeDatabase()
  21. go endpoints.InitializeContributionStreams()
  22. router := mux.NewRouter()
  23. router.HandleFunc("/GetRewardFunds", endpoints.GetRewardFunds)
  24. router.HandleFunc("/GetRewardFund", endpoints.GetRewardFund)
  25. router.HandleFunc("/GetContributions", endpoints.GetContributions)
  26. router.HandleFunc("/CreateQueue", endpoints.CreateQueue)
  27. router.HandleFunc("/GetQueues", endpoints.GetQueues)
  28. router.HandleFunc("/GetQueueMembers", endpoints.GetQueueMembers)
  29. router.HandleFunc("/CreateRewardFund", endpoints.CreateRewardFund)
  30. router.HandleFunc("/CloseRewardFund", endpoints.CloseRewardFund)
  31. //router.HandleFunc("/SubmitFund", endpoints.SubmitFund)
  32. router.HandleFunc("/GetBalance", endpoints.GetBalance)
  33. router.HandleFunc("/Contribute", endpoints.Contribute)
  34. router.HandleFunc("/ContributorStream", endpoints.ContributorStream)
  35. router.HandleFunc("/Login", endpoints.Login)
  36. router.HandleFunc("/Register", endpoints.Register)
  37. router.HandleFunc("/EscalatePrivileges", endpoints.EscalatePrivileges)
  38. router.HandleFunc("/UsersExist", endpoints.UsersExist)
  39. port := viper.GetInt("app.port")
  40. fmt.Printf("Running on port %d...\n", port)
  41. err = http.ListenAndServe(fmt.Sprintf(":%d", port), router)
  42. if err != nil {
  43. panic(fmt.Sprintf("Could not bind to port %d", port))
  44. }
  45. }