You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
481 B
20 lines
481 B
package httpserver
|
|
|
|
import (
|
|
"log"
|
|
"net/http"
|
|
)
|
|
|
|
func Start(handler http.Handler) (chan<- string, <-chan error) {
|
|
ctrlChannel := make(chan string)
|
|
errorChannel := make(chan error)
|
|
go start(ctrlChannel, errorChannel, handler)
|
|
return ctrlChannel, errorChannel
|
|
}
|
|
|
|
func start(ctrlChannel <-chan string, errorChannel chan<- error, router http.Handler) {
|
|
log.Println("Starting HTTP Server")
|
|
err := http.ListenAndServe(":8080", router)
|
|
errorChannel <- err
|
|
close(errorChannel)
|
|
}
|
|
|