Refactor into client + server backends
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package rest
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"git.ohea.xyz/mediasrv/server/client_api"
|
||||
"git.ohea.xyz/mediasrv/server/server_api"
|
||||
"github.com/op/go-logging"
|
||||
)
|
||||
|
||||
var log = logging.MustGetLogger("mediasrv-server")
|
||||
|
||||
func RunServer(address string, port int, dataDir string, scanDir string) {
|
||||
mux := http.NewServeMux()
|
||||
|
||||
client_api.SetupHTTPServer(mux, dataDir)
|
||||
server_api.SetupHTTPServer(mux, scanDir)
|
||||
|
||||
connect_string := fmt.Sprintf("%v:%v", address, port)
|
||||
log.Noticef("Launching HTTP server on %v\n", connect_string)
|
||||
log.Fatal(http.ListenAndServe(connect_string, mux))
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user