Skip to content

HTTP utility for serving multiple methods on a single URL path

License

Notifications You must be signed in to change notification settings

maxtek6/endpoints-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Endpoints

GoDoc codecov

Go module for serving multiple methods on a single HTTP path.

Usage

The Endpoint struct is an implementation of the http.Handler interface. Once an endpoint has been created, it can be served using http.Handle(), or any other function that accepts the http.Handler interface:

// create handler function
handleGet := func(w http.ResponseWriter, r *http.Request) {
    // handle GET method
}

// create new endpoint
endpoint := endpoints.New()

// map support for GET method
_ = endpoint.AddMethod(http.MethodGet, handleGet)

// mount endpoint to /path
http.Handle("/path", endpoint)

About

HTTP utility for serving multiple methods on a single URL path

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages