github.com/0chain/gosdk@v1.17.11/dev/blobber/init.go (about) 1 package blobber 2 3 import ( 4 "net/http" 5 6 "github.com/0chain/gosdk/dev/mock" 7 "github.com/gorilla/mux" 8 ) 9 10 func RegisterHandlers(r *mux.Router, m mock.ResponseMap) { 11 r.HandleFunc("/v1/file/upload/{allocation}", uploadAndUpdateFile).Methods(http.MethodPut, http.MethodPost) 12 r.HandleFunc("/v1/file/referencepath/{allocation}", getReference).Methods(http.MethodGet) 13 r.HandleFunc("/v1/file/latestwritemarker/{allocation}", latestWriteMarker).Methods(http.MethodGet) 14 r.HandleFunc("/v1/connection/commit/{allocation}", commitWrite).Methods(http.MethodPost) 15 r.HandleFunc("/v1/connection/rollback/{allocation}", rollback).Methods(http.MethodPost) 16 17 r.HandleFunc("/v1/writemarker/lock/{allocation}", mock.WithResponse(m)).Methods(http.MethodPost) 18 r.HandleFunc("/v1/writemarker/lock/{allocation}", mock.WithResponse(m)).Methods(http.MethodDelete) 19 r.HandleFunc("/v1/hashnode/root/{allocation}", mock.WithResponse(m)).Methods(http.MethodGet) 20 21 r.HandleFunc("/v1/file/meta/{allocation}", mock.WithResponse(m)).Methods(http.MethodPost) 22 23 r.NotFoundHandler = Handle404(m) 24 } 25 26 // Handle404 ... 27 func Handle404(m mock.ResponseMap) http.Handler { 28 return http.HandlerFunc(mock.WithResponse(m)) 29 }