fix pipe closed issue, and a lot of other stuff
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/http"
|
||||
_ "net/http/pprof"
|
||||
|
||||
"github.com/juls0730/flux/server"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fluxServer := server.NewServer()
|
||||
defer fluxServer.Stop()
|
||||
|
||||
http.HandleFunc("POST /deploy", fluxServer.DeployHandler)
|
||||
http.HandleFunc("DELETE /deployments", fluxServer.DeleteAllDeploymentsHandler)
|
||||
@@ -19,6 +20,9 @@ func main() {
|
||||
http.HandleFunc("GET /apps", fluxServer.ListAppsHandler)
|
||||
http.HandleFunc("GET /heartbeat", fluxServer.DaemonInfoHandler)
|
||||
|
||||
log.Printf("Fluxd started on http://127.0.0.1:5647\n")
|
||||
log.Fatal(http.ListenAndServe(":5647", nil))
|
||||
fluxServer.Logger.Info("Fluxd started on http://127.0.0.1:5647")
|
||||
err := http.ListenAndServe(":5647", nil)
|
||||
if err != nil {
|
||||
fluxServer.Logger.Fatalf("Failed to start server: %v", zap.Error(err))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user