The backend for the project formerly known as signet, now known as beignet.
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

50 rindas
1.5 KiB

  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") // TODO: change this for deployment
  16. err = viper.ReadInConfig()
  17. if err != nil {
  18. panic("Could not read in Viper config")
  19. }
  20. data.InitializeDatabase()
  21. go endpoints.InitializeContributionStream()
  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("/CreateRewardFund", endpoints.CreateRewardFund)
  27. router.HandleFunc("/CloseRewardFund", endpoints.CloseRewardFund)
  28. router.HandleFunc("/SubmitFund", endpoints.SubmitFund)
  29. router.HandleFunc("/Contribute", endpoints.Contribute)
  30. router.HandleFunc("/ContributorStream", endpoints.ContributorStream)
  31. router.HandleFunc("/Login", endpoints.Login)
  32. router.HandleFunc("/Register", endpoints.Register)
  33. router.HandleFunc("/EscalatePrivileges", endpoints.EscalatePrivileges)
  34. port := viper.GetInt("app.port")
  35. fmt.Printf("Running on port %d...\n", port)
  36. err = http.ListenAndServe(fmt.Sprintf(":%d", port), router)
  37. if err != nil {
  38. panic(fmt.Sprintf("Could not bind to port %d", port))
  39. }
  40. }