all repos — litestore @ 53b8b9dd28dd82ebd27930e4e19cb3ce38161531

A minimalist nosql document store.

Added support for favicon.
h3rald h3rald@h3rald.com
Sun, 08 Mar 2015 12:22:02 +0100
commit

53b8b9dd28dd82ebd27930e4e19cb3ce38161531

parent

07b8f9c4a9e668bed73dab42403df154f927c499

M app/index.htmlapp/index.html

@@ -6,6 +6,7 @@ <meta http-equiv="X-UA-Compatible" content="IE=edge">

<meta name="viewport" content="width=device-width, initial-scale=1"> <title>LiteStore</title> <link rel="stylesheet" href="styles/litestore.css"> + <link rel="icon" type="image/x-icon" href="favicon.ico" /> </head> <body> <script src="js/vendor/jquery.min.js"> </script>
M lib/cli.nimlib/cli.nim

@@ -9,6 +9,7 @@ types,

utils const cfgfile = "litestore.nimble".slurp +const favicon = "app/favicon.ico".slurp var file*, address*, version*, appname*: string

@@ -125,6 +126,7 @@ LS.directory = directory

LS.appversion = version LS.readonly = readonly LS.appname = appname +LS.favicon = favicon # Initialize loggers
M lib/server.nimlib/server.nim

@@ -24,6 +24,11 @@ else:

raise newException(EInvalidRequest, req.getReqInfo()) proc route(req: Request, LS: LiteStore): Response = + if req.url.path == "/favicon.ico": + result.code = Http200 + result.content = LS.favicon + result.headers = {"Content-Type": "image/x-icon"}.newStringTable + return result try: var info = req.parseApiUrl if info.version == "v1" and info.resource.match(peg"^docs / info$"):
M lib/types.nimlib/types.nim

@@ -34,6 +34,7 @@ file*: string

readonly*: bool appname*: string appversion*: string + favicon*:string Response* = tuple[ code: HttpCode, content: string,
M lib/utils.nimlib/utils.nim

@@ -105,4 +105,3 @@ result.headers = ctJsonHeader()

proc resDocumentNotFound*(id): Response = resError(Http404, "Document '$1' not found." % id) -