从 Compojure 提供静态文件
我正在尝试创建一个可自动执行的应用程序,该应用程序将运行 jetty 和 Compojure web 应用程序。将部署应用程序的用户应该能够手动修改 css 文件和一些配置文件,因此打包为 WAR 对我来说不是一个解决方案。
我的想法是在一个目录中有一个可自执行的 JAR,并在其下有一个 webdata/static/css 目录。
但是,当使用以下路由时,不提供 css 目录中的文件:
(route/files "/static" {:root (str (System/getProperty "user.dir") "/webdata")})
有什么问题吗?
I'm trying to have a self-executable app that will runs jetty and a Compojure webapp. The user who will deploy the app should be able to modify manually the css files and some configurations files, so packaging as a WAR is not a solution for me.
My idea is to have a self-executable JAR in one directory and a webdata/static/css directory under it.
However when using the following route, the file in the css directory are not served:
(route/files "/static" {:root (str (System/getProperty "user.dir") "/webdata")})
What is the problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我发现了错误,路径没有正确指定。此代码有效:
项目的树结构如下所示:
Ok I found the error, the path wasn't specified correctly. This code works:
The tree structure of the project is then like this: