mirror of
https://github.com/arnaucube/blockchainIDsystem.git
synced 2026-02-07 11:06:41 +01:00
peers propagation working fine, started to implement serverCA
This commit is contained in:
39
serverCA/restRoutes.go
Executable file
39
serverCA/restRoutes.go
Executable file
@@ -0,0 +1,39 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type Routes []Route
|
||||
|
||||
var routes = Routes{
|
||||
Route{
|
||||
"Index",
|
||||
"GET",
|
||||
"/",
|
||||
Index,
|
||||
},
|
||||
Route{
|
||||
"GetPeers",
|
||||
"GET",
|
||||
"/peers",
|
||||
GetPeers,
|
||||
},
|
||||
}
|
||||
|
||||
type Address struct {
|
||||
Address string `json:"address"` //the pubK of the user, to perform logins
|
||||
}
|
||||
|
||||
func Index(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Fprintln(w, "CA")
|
||||
}
|
||||
func GetPeers(w http.ResponseWriter, r *http.Request) {
|
||||
getPeers()
|
||||
|
||||
jResp, err := json.Marshal(peersList)
|
||||
check(err)
|
||||
fmt.Fprintln(w, string(jResp))
|
||||
}
|
||||
Reference in New Issue
Block a user