[#15] Update doc url

Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
Denis Kirillov 2022-07-12 10:31:06 +03:00 committed by Alex Vanin
parent fca6d718f5
commit 0df815ed27
5 changed files with 10 additions and 5 deletions

View file

@ -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

View file

@ -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)

View file

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 68 KiB

View file

@ -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:
<img src="doc/acl-basic.svg" alt="acl-basic">
<img src="docs/acl-basic.svg" alt="acl-basic">
| Symbol | Meaning | Description |
|--------|:--------|------------------------------------------------------------------------------------------------|

View file

@ -9,7 +9,7 @@
<script src="https://cdn.jsdelivr.net/npm/@webcomponents/webcomponentsjs@2/webcomponents-loader.min.js"></script>
<script type="module" src="https://cdn.jsdelivr.net/gh/zerodevx/zero-md@1/src/zero-md.min.js"></script>
<zero-md src="doc/doc.md"></zero-md>
<zero-md src="docs/docs.md"></zero-md>
</body>
</html>