1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-19 13:19:43 +02:00

Provide helpers to for adding API routes

This commit is contained in:
sauls8t 2018-03-19 12:24:34 +00:00
parent 8466cafe1f
commit bc2cab5721
2 changed files with 114 additions and 104 deletions

View file

@ -88,6 +88,16 @@ func Add(rt *env.Runtime, prefix, path string, methods, queries []string, endPtF
return nil
}
// AddPrivate endpoint
func AddPrivate(rt *env.Runtime, path string, methods, queries []string, endPtFn RouteFunc) error {
return Add(rt, RoutePrefixPrivate, path, methods, queries, endPtFn)
}
// AddPublic endpoint
func AddPublic(rt *env.Runtime, path string, methods, queries []string, endPtFn RouteFunc) error {
return Add(rt, RoutePrefixPublic, path, methods, queries, endPtFn)
}
// Remove an endpoint.
func Remove(rt *env.Runtime, prefix, path string, methods, queries []string) error {
k, e := routesKey(rt, prefix, path, methods, queries)