Hey everyone

I am building a Desktop application with golang.
The Frontend is Electron, and the Backend if Golang.
They talk over http.

I have managed to combine the two into a single compile & run, but i need 
the backend server to NOT alert when it starts at the 
"http.ListenAndServe(":8080", nil)".
The reason being that its just poor user experience.
Any ideas ?


func main() {

// start backend
fmt.Println("starting backend... ")

http.HandleFunc("/", b.HomeHandler)
http.HandleFunc("/hello/", b.HelloHandler)
http.HandleFunc("/api/test/", b.ApiTestHandler)

fmt.Println("backend listening on localhost:8080")
go func() {
http.ListenAndServe(":8080", nil)

}()

// start frontend
fmt.Println("starting frontend .... ")

cmd := exec.Command("electron", "../frontend/.")

var waitStatus syscall.WaitStatus
if err := cmd.Run(); err != nil {
printError(err)
// Did the command fail because of an unsuccessful exit code
if exitError, ok := err.(*exec.ExitError); ok {
waitStatus = exitError.Sys().(syscall.WaitStatus)
printOutput([]byte(fmt.Sprintf("%d", waitStatus.ExitStatus())))
}
} else {
// Command was successful
waitStatus = cmd.ProcessState.Sys().(syscall.WaitStatus)
printOutput([]byte(fmt.Sprintf("%d", waitStatus.ExitStatus())))
}

}


-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to