nim-lang - nim jester如何更改静态路由和目录

标签 nim-lang

更改 jester 提供静态文件的静态路由和目录的正确方法是什么?

我尝试了各种排列:

routes:
  get "/static":
    setStaticDir(request,"./semantic/dist")

但不要让它发挥作用。

我收到404错误网关错误。

最佳答案

这使得 semantic/dist 中的每个文件都可以在 / 处使用,例如 semantic/dist/foo.html 将位于 http://localhost:5000/foo.html :

import jester, asyncdispatch, htmlgen

settings:
  staticDir = "semantic/dist"

routes:
  get "/":
    resp h1("Hello World")

runForever()

关于nim-lang - nim jester如何更改静态路由和目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35972896/

相关文章:

templates - 尼姆 : How to wrap/derive an iterator from another iterator?

nim-lang - Nim 中的 !$(bang dollar)运算符是什么?

设置 HashTable 和 HashSet 的键之间的差异

nim-lang - Nim 中的字符串枚举类型?

include - 如何从 Nim 中的导入失败中恢复?

sorting - 如何在 Nim 中对序列进行排序?

format - nim 中的多类型格式化(相当于 boost 格式)

nim-lang - 将日志分析脚本从 Python 转换为 Nim

c++ - 在 nim 中包装嵌套的模板化类型

profiling - 如何使用 nimprof?