Doc updates; corrected ID handling of imported documents.
h3rald h3rald@h3rald.com
Fri, 06 Mar 2020 12:23:10 +0100
5 files changed,
9 insertions(+),
17 deletions(-)
M
build_guide
→
build_guide
@@ -7,7 +7,7 @@ md/architecture.md
md/getting-started.md md/usage.md md/auth.md - md/custom_resources.md + md/middleware.md md/litestore_js_object.md md/admin_app.md md/api.md@@ -16,7 +16,6 @@ md/api_dir.md
md/api_docs.md md/api_tags.md md/api_indexes.md - md/api_custom.md md/nim-api.md md/nim-api_high.md md/nim-api_low.md
D
src/admin/md/api_custom.md
@@ -1,12 +0,0 @@
-### custom (LiteStore Custom Resources) - -> %note% -> API v6 Required -> -> This resource has been introduced in version 6 of the LiteStore API. - -The **custom** endpoint is used to exposed resources defined by the user by the means of JavaScript handlers. - -For example, if a handler is defined in a file called **test.js**, it will be accessible at the following URL: - -http://localhost:9500/custom/test/
M
src/admin/md/custom_resources.md
→
src/admin/md/middleware.md
@@ -1,4 +1,4 @@
-## Custom Resources +## Middleware As of version 1.8.0, you can define your own custom resources using handlers coded in JavaScript.
M
src/litestorepkg/lib/core.nim
→
src/litestorepkg/lib/core.nim
@@ -460,7 +460,12 @@ proc importFile*(store: Datastore, f: string, dir = "/", system = false) =
if not f.fileExists: raise newException(EFileNotFound, "File '$1' not found." % f) let ext = f.splitFile.ext - var d_id = f.replace("\\", "/")[dir.len+1..f.len-1]; + var d_id: string + if system: + # Do not save original directory name + d_id = f.replace("\\", "/")[dir.len+1..f.len-1]; + else: + d_id = f.replace("\\", "/"); var d_contents = f.readFile var d_ct = "application/octet-stream" if CONTENT_TYPES.hasKey(ext):