mirror of
https://github.com/kataras/iris.git
synced 2025-12-21 03:47:04 +00:00
add PartyFunc and gofmt -s -w . 🔷
Former-commit-id: a3809498a45140d691f3f235ad9cb25239d495a2
This commit is contained in:
@@ -215,6 +215,28 @@ func (rb *APIBuilder) Party(relativePath string, handlers ...context.Handler) Pa
|
||||
}
|
||||
}
|
||||
|
||||
// PartyFunc same as `Party`, groups routes that share a base path or/and same handlers.
|
||||
// However this function accepts a function that receives this created Party instead.
|
||||
// Returns the Party in order the caller to be able to use this created Party to continue the
|
||||
// top-bottom routes "tree".
|
||||
//
|
||||
// Note: `iris#Party` and `core/router#Party` describes the exactly same interface.
|
||||
//
|
||||
// Usage:
|
||||
// app.PartyFunc("/users", func(u iris.Party){
|
||||
// u.Use(authMiddleware, logMiddleware)
|
||||
// u.Get("/", getAllUsers)
|
||||
// u.Post("/", createOrUpdateUser)
|
||||
// u.Delete("/", deleteUser)
|
||||
// })
|
||||
//
|
||||
// Look `Party` for more.
|
||||
func (rb *APIBuilder) PartyFunc(relativePath string, partyBuilderFunc func(p Party)) Party {
|
||||
p := rb.Party(relativePath)
|
||||
partyBuilderFunc(p)
|
||||
return p
|
||||
}
|
||||
|
||||
// Subdomain returns a new party which is responsible to register routes to
|
||||
// this specific "subdomain".
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user