mirror of
https://github.com/minio/minio.git
synced 2024-12-26 23:25:54 -05:00
21 lines
536 B
Go
21 lines
536 B
Go
package httpserver
|
|
|
|
import (
|
|
"log"
|
|
"net/http"
|
|
)
|
|
|
|
func Start(handler http.Handler, address string) (chan<- string, <-chan error) {
|
|
ctrlChannel := make(chan string)
|
|
errorChannel := make(chan error)
|
|
go start(ctrlChannel, errorChannel, handler, address)
|
|
return ctrlChannel, errorChannel
|
|
}
|
|
|
|
func start(ctrlChannel <-chan string, errorChannel chan<- error, router http.Handler, address string) {
|
|
log.Println("Starting HTTP Server on " + address)
|
|
err := http.ListenAndServe(address, router)
|
|
errorChannel <- err
|
|
close(errorChannel)
|
|
}
|