all repos — litestore @ f71a83e924f1b045996cd45f8fc860a45b37e7f0

A minimalist nosql document store.

Modified example to properly manage OPTIONS and HEAD.
h3rald h3rald@h3rald.com
Fri, 13 Oct 2017 21:28:22 +0200
commit

f71a83e924f1b045996cd45f8fc860a45b37e7f0

parent

1472fe10c3ef43e00dc95c85b03bbfb7a29adf9e

1 files changed, 11 insertions(+), 3 deletions(-)

jump to
M examples/jester_integration.nimexamples/jester_integration.nim

@@ -1,4 +1,4 @@

-import jester, ../litestore, asyncdispatch, re +import jester, ../litestore, asyncdispatch, re, strtabs, asyncnet litestore.setup()

@@ -31,10 +31,18 @@ resp(r.code, r.content)

head re"^\/litestore\/docs\/?(.*)": let r = head("docs", request.matches[0], request.headers) - resp(r.code, r.content) + headers = newStringTable() + for key, value in r.headers.pairs: + headers[key] = value + await response.sendHeaders(r.code, headers) + response.client.close() options re"^\/litestore\/docs\/?(.*)": let r = options("docs", request.matches[0], request.headers) - resp(r.code, r.content) + headers = newStringTable() + for key, value in r.headers.pairs: + headers[key] = value + await response.sendHeaders(r.code, headers) + response.client.close() runForever()