all repos — litestore @ bd2fa1c09df1591de45af167a5d4587b1b0cc578

A minimalist nosql document store.

Doc updates; corrected ID handling of imported documents.
h3rald h3rald@h3rald.com
Fri, 06 Mar 2020 12:23:10 +0100
commit

bd2fa1c09df1591de45af167a5d4587b1b0cc578

parent

4f6b45c773c9488f8ee6e11ffbabd6c196b4270d

M build_guidebuild_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
M src/admin/js/components/navbar.jssrc/admin/js/components/navbar.js

@@ -18,7 +18,7 @@ {path: "/guide/data_model", title: caret+"Data Model"},

{path: "/guide/getting-started", title: "Getting Started"}, {path: "/guide/usage", title: "Usage"}, {path: "/guide/auth", title: "Authorization"}, - {path: "/guide/custom_resources", title: "Custom Resources"}, + {path: "/guide/middleware", title: "Middleware"}, {path: "/guide/litestore_js_object", title: caret+"LiteStore Global Object"}, {path: "/guide/admin_app", title: "Administration App"}, {path: "/guide/api", title: "HTTP API Reference"},
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.mdsrc/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.nimsrc/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):