`staticDir` with configurable public dir
### Discussed in https://github.com/HapticX/happyx/discussions/199

<div type='discussions-op-text'>

<sup>Originally posted by **jerrygzy** November 28, 2023</sup>
hi, I am having a error with configurable public dir in the following code.

`main.nim`
```nim
serve("0.0.0.0", 5000):
  let public_dir = "happy"
  #staticDir public_dir ~ "js,json,css"  #  this failed to serve files !!
  staticDir "happy" ~ "js,json,css"  
  get "/":
    {.gcsafe.}:
      return mainPage(public_dir, inCookies) 
  get "/{title:string}":
    return userPage(title,public_dir,inCookies) 
```

ideally I would write my code like below

`main.nim`
```nim
# Init DB & public dir
let config = configServer()


# Server Loop
serve("0.0.0.0", 5000):
  let public_dir = config["domain_name"]
  staticDir public_dir ~ "js,json,css"
  get "/":
    {.gcsafe.}:
      return mainPage(public_dir, inCookies) 
  get "/{title:string}":
    return userPage(title,public_dir,inCookies) 
```

but I got error below
```
Error: 'main' is not GC-safe as it accesses 'config' which is a global using GC'ed memory
```
</div>