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

gossif/httpserver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HttpServer

Default Go http server with middleware for logging and the option to verbose the request and response.

Usage

	mux := http.NewServeMux()
	mux.HandleFunc("/ping", func(w http.ResponseWriter, _ *http.Request) {
		w.WriteHeader(http.StatusOK)
		_, _ = fmt.Fprintf(w, "pong")
	})
	handler := cors.Default().Handler(mux)
	server := httpserver.NewHttpServer(
		httpserver.WithPort("9082"),
		httpserver.WithHandlers(handler),
		httpserver.WithVerbose(false),
	)
	server.Start(context.Background())

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages