25 lines
573 B
Go
25 lines
573 B
Go
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))
|
|
|
|
}
|