Add internal/server/user/server{,_test}.go

Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
This commit is contained in:
pancho horrillo
2019-10-07 19:05:59 +02:00
parent 10da324a57
commit 10586bae95
3 changed files with 155 additions and 1 deletions
+31
View File
@@ -0,0 +1,31 @@
package user
import (
"net/http"
"sync"
"github.com/gorilla/mux"
)
type swappableMux struct {
m sync.RWMutex
root mux.Router
}
func (sm *swappableMux) get() mux.Router {
sm.m.RLock()
defer sm.m.RUnlock()
return sm.root
}
func (sm *swappableMux) set(mux mux.Router) {
sm.m.Lock()
sm.root = mux
sm.m.Unlock()
}
var Server http.Server
func Run() {
}