这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion router.go
Original file line number Diff line number Diff line change
Expand Up @@ -592,10 +592,17 @@ const (
// New creates a new Huma router to which you can attach resources,
// operations, middleware, etc.
func New(docs, version string) *Router {
return NewWithMux(docs, version, chi.NewRouter())
}

// NewWithMux creates a new Huma router to which you can attach resources,
// operations, middleware, etc. It allows you to specify the underlying
// `*chi.Mux` instance to use.
func NewWithMux(docs, version string, mux *chi.Mux) *Router {
title, desc := splitDocs(docs)

r := &Router{
mux: chi.NewRouter(),
mux: mux,
resources: []*Resource{},
title: title,
description: desc,
Expand Down