From 7e48c18dc6dc8abc55d728cc1c2e0bbdae41a32c Mon Sep 17 00:00:00 2001 From: bung87 Date: Tue, 16 Jan 2024 22:14:13 +0800 Subject: [PATCH] static example use static dir path --- benchmark/simple_resp.nim.cfg | 1 - examples/static.nim | 1 - examples/static.nims | 4 +++- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/benchmark/simple_resp.nim.cfg b/benchmark/simple_resp.nim.cfg index 8520ab0..9561d68 100644 --- a/benchmark/simple_resp.nim.cfg +++ b/benchmark/simple_resp.nim.cfg @@ -2,6 +2,5 @@ -d:release -d:GzipEnable=false --opt:speed --d:danger # -d:threadsafe --threads:off \ No newline at end of file diff --git a/examples/static.nim b/examples/static.nim index f3ab665..0825e0c 100644 --- a/examples/static.nim +++ b/examples/static.nim @@ -1,7 +1,6 @@ import scorper when isMainModule: - # cd `example` dir first then run `nim c -r static.nim` let r = newRouter[ScorperCallback]() r.addRoute(serveStatic, "get", "/static/*$") let address = "127.0.0.1:8888" diff --git a/examples/static.nims b/examples/static.nims index 5747196..cb6dcfe 100644 --- a/examples/static.nims +++ b/examples/static.nims @@ -1 +1,3 @@ -putEnv("StaticDir","./static") \ No newline at end of file +import os + +putEnv("StaticDir", currentSourcePath.parentDir / "static") \ No newline at end of file