The backend for the project formerly known as signet, now known as beignet.
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

54 Zeilen
1.7 KiB

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