Added support for favicon.
h3rald h3rald@h3rald.com
Sun, 08 Mar 2015 12:22:02 +0100
7 files changed,
9 insertions(+),
1 deletions(-)
M
app/index.html
→
app/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.nim
→
lib/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.nim
→
lib/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.nim
→
lib/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.nim
→
lib/utils.nim
@@ -105,4 +105,3 @@ result.headers = ctJsonHeader()
proc resDocumentNotFound*(id): Response = resError(Http404, "Document '$1' not found." % id) -