Refactor into client + server backends

This commit is contained in:
2023-01-04 21:34:26 -07:00
parent 2087cf2c03
commit 38127948bd
16 changed files with 361 additions and 120 deletions
+24
View File
@@ -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))
}