Return info about blockbook as default response

This commit is contained in:
Martin Boehm 2018-05-10 13:11:09 +02:00
parent 8535786ce3
commit 66bf41720b

View File

@ -85,7 +85,9 @@ func NewSocketIoServer(binding string, certFiles string, db *db.RocksDB, chain b
// API call used to detect state of Blockbook
serveMux.HandleFunc(path+"api/block-index/", s.apiBlockIndex)
// handle socket.io
serveMux.Handle(path, server)
serveMux.Handle(path+"socket.io/", server)
// default handler
serveMux.HandleFunc(path, s.index)
server.On("message", s.onMessage)
server.On("subscribe", s.onSubscribe)
@ -129,6 +131,10 @@ func (s *SocketIoServer) txRedirect(w http.ResponseWriter, r *http.Request) {
}
}
func (s *SocketIoServer) index(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(blockbookAbout))
}
func (s *SocketIoServer) apiBlockIndex(w http.ResponseWriter, r *http.Request) {
type resBlockIndex struct {
BlockHash string `json:"blockHash"`