|
- package main
-
- import (
- "fmt"
- "net/http"
-
- "github.com/gorilla/mux"
- "github.com/imosed/signet/data"
- "github.com/imosed/signet/endpoints"
- "github.com/spf13/viper"
- )
-
- var err error
-
- // Testnet wallet: GDQZ34LBZSUYFR3DSDYFDLNYDHRXPUB76FIW2FTESYHRUOGZ6GXN5LOS
- // Testnet secret: SCDYZYNZIDYHU3HNIBDZEVCRD2QB2VOZWJR3XP63FA6AOC6GQQSZ3C3U
-
- // TODO: beignet.io
-
- func main() {
- viper.SetConfigFile("config.production.json")
- err = viper.ReadInConfig()
- if err != nil {
- panic("Could not read in Viper config")
- }
-
- data.InitializeDatabase()
-
- go endpoints.InitializeContributionStreams()
-
- router := mux.NewRouter()
- router.HandleFunc("/GetRewardFunds", endpoints.GetRewardFunds)
- router.HandleFunc("/GetRewardFund", endpoints.GetRewardFund)
- router.HandleFunc("/GetContributions", endpoints.GetContributions)
- router.HandleFunc("/CreateQueue", endpoints.CreateQueue)
- router.HandleFunc("/GetQueues", endpoints.GetQueues)
- router.HandleFunc("/GetQueueMembers", endpoints.GetQueueMembers)
- router.HandleFunc("/CreateRewardFund", endpoints.CreateRewardFund)
- router.HandleFunc("/CloseRewardFund", endpoints.CloseRewardFund)
- // router.HandleFunc("/SubmitFund", endpoints.SubmitFund)
- router.HandleFunc("/GetBalance", endpoints.GetBalance)
- router.HandleFunc("/Contribute", endpoints.Contribute)
- router.HandleFunc("/ContributorStream", endpoints.ContributorStream)
- router.HandleFunc("/Login", endpoints.Login)
- router.HandleFunc("/Register", endpoints.Register)
- router.HandleFunc("/EscalatePrivileges", endpoints.EscalatePrivileges)
- router.HandleFunc("/UsersExist", endpoints.UsersExist)
-
- port := viper.GetInt("app.port")
- fmt.Printf("Running on port %d...\n", port)
- err = http.ListenAndServe(fmt.Sprintf(":%d", port), router)
- if err != nil {
- panic(fmt.Sprintf("Could not bind to port %d", port))
- }
- }
|