The backend for the project formerly known as signet, now known as beignet.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

main.go 2.2 KiB

il y a 2 ans
il y a 1 an
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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/rs/zerolog"
  9. "github.com/rs/zerolog/log"
  10. "github.com/spf13/viper"
  11. )
  12. var err error
  13. // Testnet wallet: GDQZ34LBZSUYFR3DSDYFDLNYDHRXPUB76FIW2FTESYHRUOGZ6GXN5LOS
  14. // Testnet secret: SCDYZYNZIDYHU3HNIBDZEVCRD2QB2VOZWJR3XP63FA6AOC6GQQSZ3C3U
  15. func main() {
  16. viper.SetConfigFile("config.production.json")
  17. err = viper.ReadInConfig()
  18. if err != nil {
  19. log.Error().Err(err).Msg("Could not read in Viper config")
  20. }
  21. zerolog.TimeFieldFormat = zerolog.TimeFormatUnix
  22. data.InitializeDatabase()
  23. go endpoints.InitializeContributionStreams()
  24. router := mux.NewRouter()
  25. router.HandleFunc("/GetRewardFunds", endpoints.GetRewardFunds)
  26. router.HandleFunc("/GetRewardFund", endpoints.GetRewardFund)
  27. router.HandleFunc("/GetContributions", endpoints.GetContributions)
  28. router.HandleFunc("/CreateQueue", endpoints.CreateQueue)
  29. router.HandleFunc("/GetQueues", endpoints.GetQueues)
  30. router.HandleFunc("/GetQueueMembers", endpoints.GetQueueMembers)
  31. router.HandleFunc("/EditQueue", endpoints.EditQueue)
  32. router.HandleFunc("/CreateRewardFund", endpoints.CreateRewardFund)
  33. router.HandleFunc("/CloseRewardFund", endpoints.CloseRewardFund)
  34. router.HandleFunc("/SubmitRewardFund", endpoints.SubmitFund)
  35. router.HandleFunc("/DistributeRewardFund", endpoints.DistributeRewards)
  36. router.HandleFunc("/GetUsers", endpoints.GetUsers)
  37. router.HandleFunc("/GetBalance", endpoints.GetBalance)
  38. router.HandleFunc("/Contribute", endpoints.Contribute)
  39. router.HandleFunc("/ContributorStream", endpoints.ContributorStream)
  40. router.HandleFunc("/Login", endpoints.Login)
  41. router.HandleFunc("/Register", endpoints.Register)
  42. router.HandleFunc("/ChangePassword", endpoints.ChangePassword)
  43. router.HandleFunc("/NearlyCompleteFunds", endpoints.NearlyCompleteFunds)
  44. router.HandleFunc("/ChangePrivileges", endpoints.ChangePrivileges)
  45. router.HandleFunc("/UsersExist", endpoints.UsersExist)
  46. port := viper.GetInt("app.port")
  47. fmt.Printf("Running on port %d...\n", port)
  48. err = http.ListenAndServe(fmt.Sprintf(":%d", port), router)
  49. if err != nil {
  50. log.Error().Err(err).Msg(fmt.Sprintf("Could not bind to port %d", port))
  51. }
  52. }