20 lines
366 B
Go
20 lines
366 B
Go
package api
|
|
|
|
import (
|
|
"dejo_node/internal/ws"
|
|
"net/http"
|
|
|
|
"github.com/gorilla/mux"
|
|
)
|
|
|
|
func NewServer(handler *Handler) http.Handler {
|
|
r := mux.NewRouter()
|
|
|
|
// Endpoints básicos
|
|
r.HandleFunc("/ping", handler.Ping).Methods("GET")
|
|
r.HandleFunc("/consensus", handler.HandleConsensus).Methods("POST")
|
|
r.HandleFunc("/ws", ws.HandleWS).Methods("GET")
|
|
|
|
return r
|
|
}
|