Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

Konstantin8105/WaitServerStart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WaitServerStart

Coverage Status Build Status Go Report Card GitHub license GoDoc

Simple waiter of server start

func main() {
	// Start a server
	srv, address := startHttpServer()

	// Wait starting of server
	<-wait.ByAddress(address)

	// Testing
	resp, err := http.Get(address)
	if err != nil {
		fmt.Println("RESPONSE")
		panic(err)
	}
	fmt.Println("Server is run...")
	_ = resp.Body.Close()
	if err := srv.Shutdown(context.Background()); err != nil {
		panic(err)
	}

	// Output: Server is run...
}