I suppose this is a strange question to the huge majority of programmers that work daily with Java. I don't. I know Java-the-language, because I worked on Java projects, but not Java-the-world. I never made a web app from scratch in Java. If I have to do it with Python, Ruby, I know where to go (Django or Rails), but if I want to make a web application in Clojure, not because I'm forced to live in a Java world, but because I like the language and I want to give it a try, what libraries and frameworks should I use?
当前回答
我将对来自@weavejester (Compojure和Ring的维护者)的pipe发表我的意见。
它的核心是将Component和Ring路由器放在一个屋檐下。我使用管道的原因:
Excellent philosophical foundation: it encourages you to build your app as a series of small components, and it strikes a nice balance between holding few opinions while providing sane defaults. Stable path: I speak for myself, but over the years I've felt that the Clojure community has presented one less-than-credible web framework after another. A couple simply felt too experimental (my experience with Om and client-side Pedestal) for "getting things done" (not that they won't prove superior down the road). On the other hand, I feel like @weavejester has brought the same stability and measured progress to Duct that he did to Compojure and Ring, which have been superbly born out in the community. It's super lightweight, and out of the way of my components.
主要特点:
通过“端点”组织路由,你可以把这些小组件想象成迷你web服务器(或者,HTTP路由的小截面)。 重新加载工作流的开箱即用支持。 与Ring和Compojure完美集成。 开发和生产配置(这是我在其他地方发现的明显缺失的部分)。 带有示例的良好文档。
注意:这是不言而喻的,但对于web开发新手来说,就像大多数Clojurey的东西一样,pipe要求扎实掌握Clojure语言。我还建议先阅读Component。
在另一个个人注意,我已经在几个生产应用程序中使用了一年多了,对它非常满意。
其他回答
Reframe和om。接下来可能就是你要找的了。
Arachne是一个新的web框架。 引用网站的描述:
Arachne是一个完整的、高度模块化的web开发框架 Clojure。它强调轻松、简单和可靠、可扩展 设计。
它有一个 kickstarter运动 声称提供类似Rails的“入门”体验。它是 由一个Cognitect开发。
这是 与鲁米努斯(瑜伽)的作者进行了很好的讨论。
到目前为止,我所遇到的最好的Clojure web框架是Compojure: http://github.com/weavejester/compojure/tree/master
它很小,但功能强大,并且具有漂亮优雅的语法。(它在底层使用Jetty,但它对您隐藏了Servlet API,除非您需要它,但这种情况不会经常发生)。去看看那个URL的README,然后下载一个快照并开始播放。
我已经成功地在生产环境中使用Liberator一段时间了。如果你只是想要一个基本的框架,例如,如果你正在构建一个RESTful web服务或类似的东西,它是一个很好的框架。它本质上是ring和compojure的包装器,并在验证传入请求时提供决策图。与其他更笨重的web框架相比,它的速度也非常快。如果你想快速开始,然后慢慢建立,那么解放者是一个很好的选择。
你也可以尝试Clojure线圈,http://github.com/zubairq/coils -免责声明:我是作者