forked from Wysteriya/baby-chain
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
34 lines (30 loc) · 784 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package main
import (
"baby-chain/gpp"
"baby-chain/gpp/services"
"github.com/gin-gonic/gin"
"log"
)
func publicRoutes(rg *gin.RouterGroup) {
clientRoute := rg.Group("/public")
clientRoute.GET("/sync", services.SyncGet)
clientRoute.POST("/sync", services.SyncPost)
}
func privateRoutes(rg *gin.RouterGroup) {
clientRoute := rg.Group("/private")
clientRoute.POST("/node", services.NodePost)
}
func main() {
gpp.BC, gpp.SD, gpp.CSAlgo = gpp.FetchHyperParams()
chainName := "baby_chain"
go func() {
server := gin.Default()
basePath := server.Group("/" + chainName)
privateRoutes(basePath)
log.Fatalln(server.Run("127.0.0.1:9080"))
}()
server := gin.Default()
basePath := server.Group("/" + chainName)
publicRoutes(basePath)
log.Fatalln(server.Run(":9090"))
}