Documentation ¶
Index ¶
- func BuildPackageURL(baseURL string, p *hub.Package, version string) string
- type Handlers
- func (h *Handlers) Get(w http.ResponseWriter, r *http.Request)
- func (h *Handlers) GetRandom(w http.ResponseWriter, r *http.Request)
- func (h *Handlers) GetStarredByUser(w http.ResponseWriter, r *http.Request)
- func (h *Handlers) GetStars(w http.ResponseWriter, r *http.Request)
- func (h *Handlers) GetStats(w http.ResponseWriter, r *http.Request)
- func (h *Handlers) InjectIndexMeta(next http.Handler) http.Handler
- func (h *Handlers) RssFeed(w http.ResponseWriter, r *http.Request)
- func (h *Handlers) Search(w http.ResponseWriter, r *http.Request)
- func (h *Handlers) ToggleStar(w http.ResponseWriter, r *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Handlers ¶
type Handlers struct {
// contains filtered or unexported fields
}
Handlers represents a group of http handlers in charge of handling packages operations.
func NewHandlers ¶
func NewHandlers(pkgManager hub.PackageManager, cfg *viper.Viper) *Handlers
NewHandlers creates a new Handlers instance.
func (*Handlers) Get ¶
func (h *Handlers) Get(w http.ResponseWriter, r *http.Request)
Get is an http handler used to get a package details.
func (*Handlers) GetRandom ¶ added in v0.3.0
func (h *Handlers) GetRandom(w http.ResponseWriter, r *http.Request)
GetRandom is an http handler used to get some random packages from the hub database.
func (*Handlers) GetStarredByUser ¶
func (h *Handlers) GetStarredByUser(w http.ResponseWriter, r *http.Request)
GetStarredByUser is an http handler used to get the packages starred by the user doing the request.
func (*Handlers) GetStars ¶
func (h *Handlers) GetStars(w http.ResponseWriter, r *http.Request)
GetStars is an http handler used to get the number of stars of the package provided.
func (*Handlers) GetStats ¶
func (h *Handlers) GetStats(w http.ResponseWriter, r *http.Request)
GetStats is an http handler used to get some stats about packages registered in the hub database.
func (*Handlers) InjectIndexMeta ¶
InjectIndexMeta is a middleware that injects the some index metadata related to a given package,
func (*Handlers) RssFeed ¶ added in v0.3.0
func (h *Handlers) RssFeed(w http.ResponseWriter, r *http.Request)
RssFeed is an http handler used to get the RSS feed of a given package.
func (*Handlers) Search ¶
func (h *Handlers) Search(w http.ResponseWriter, r *http.Request)
Search is an http handler used to searchPackages for packages in the hub database.
func (*Handlers) ToggleStar ¶
func (h *Handlers) ToggleStar(w http.ResponseWriter, r *http.Request)
ToggleStar is an http handler used to toggle the star on a given package.