From 0df815ed27d0248500d82cb8393fe7e3ab49e986 Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Tue, 12 Jul 2022 10:31:06 +0300 Subject: [PATCH] [#15] Update doc url Signed-off-by: Denis Kirillov --- README.md | 5 +++++ handlers/api.go | 6 +++--- static/{doc => docs}/acl-basic.svg | 0 static/{doc/doc.md => docs/docs.md} | 2 +- static/{doc => docs}/index.html | 2 +- 5 files changed, 10 insertions(+), 5 deletions(-) rename static/{doc => docs}/acl-basic.svg (100%) rename static/{doc/doc.md => docs/docs.md} (98%) rename static/{doc => docs}/index.html (90%) diff --git a/README.md b/README.md index 678fbf8..09c0d7a 100644 --- a/README.md +++ b/README.md @@ -77,3 +77,8 @@ In general, everything available as CLI parameter can also be specified via envi specifically mentioned in most cases (see `--help` also). If you prefer a config file you can use it in yaml format. See config [examples](./config) for details. + +## Docs +You can see additional docs and swagger specification using the following url (suppose you ran rest-gw on `localhost:8090`): +* http://localhost:8090/docs - rest-gw documentation +* http://localhost:8090/v1/docs - swagger specification diff --git a/handlers/api.go b/handlers/api.go index 41b15af..97cc798 100644 --- a/handlers/api.go +++ b/handlers/api.go @@ -54,7 +54,7 @@ const ( // ContextKeyRequestID is the ContextKey for RequestID. ContextKeyRequestID ContextKey = "requestID" - docPrefix = "/doc" + docsPrefix = "/docs" ) // New creates a new API using specified logger, connection pool and other parameters. @@ -126,10 +126,10 @@ func (a *API) setupGlobalMiddleware(handler http.Handler) http.Handler { } func (a *API) docMiddleware(handler http.Handler) http.Handler { - fh := http.StripPrefix(docPrefix, http.FileServer(http.Dir("static/doc"))) + fh := http.StripPrefix(docsPrefix, http.FileServer(http.Dir("static/docs"))) return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if strings.HasPrefix(r.URL.Path, docPrefix) { + if strings.HasPrefix(r.URL.Path, docsPrefix) { fh.ServeHTTP(w, r) } else { handler.ServeHTTP(w, r) diff --git a/static/doc/acl-basic.svg b/static/docs/acl-basic.svg similarity index 100% rename from static/doc/acl-basic.svg rename to static/docs/acl-basic.svg diff --git a/static/doc/doc.md b/static/docs/docs.md similarity index 98% rename from static/doc/doc.md rename to static/docs/docs.md index f143f55..fa55822 100644 --- a/static/doc/doc.md +++ b/static/docs/docs.md @@ -31,7 +31,7 @@ REP 3 Basic ACL is a part of the container structure, and it is always created simultaneously with the container. Therefore, it is never subject to any changes. It is a 32-bit integer with a bit field in the following format: -acl-basic +acl-basic | Symbol | Meaning | Description | |--------|:--------|------------------------------------------------------------------------------------------------| diff --git a/static/doc/index.html b/static/docs/index.html similarity index 90% rename from static/doc/index.html rename to static/docs/index.html index a630791..b712628 100644 --- a/static/doc/index.html +++ b/static/docs/index.html @@ -9,7 +9,7 @@ - +