webjure 与 compojure?

发布于 2024-07-12 03:38:22 字数 72 浏览 7 评论 0 原文

我听说过两个基于 Clojure 的 Web 应用程序框架:Webjure 和 Compojure。 有人可以告诉我哪个更好吗?

I've heard of two Clojure based web application frameworks: Webjure and Compojure. Can someone let me know which is better?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

梦言归人 2024-07-19 03:38:22

现在,您可以将Ring添加到列表中。 所有这些框架都是非常新的,并且可能会快速发展(或消亡),但根据过去 6 个月左右的时间,Compojure 似乎确实是开发最活跃的。

“更好”是一个过于主观的问题,无法得到明确的答案。 全部尝试一下,看看什么有效。

Now you can add Ring to the list. All of these frameworks are very new and likely to evolve (or die) quickly, but Compojure does seem to be the most actively developed based on the past 6 months or so.

"Better" is too subjective a question to get a definitive answer to. Try them all and see what works.

莫言歌 2024-07-19 03:38:22

到目前为止,Compojure 对我来说运行得很好。 我喜欢设计的简单性、灵活性以及它鼓励良好的惯用功能风格的事实。

示例服务器:

(use 'compojure)

(defroutes my-app
  (GET "/index.html"
    (html 
      [:h1 "Hello World!!"]
      [:body "This is some text"]))
  (ANY "*"
    [404 "Page not found"]))

(run-server {:port 80}
  "/*" (servlet my-app))

请注意,Compojure 在内部使用 Ring。

Compojure has been working very well for me so far. I like the simplicity of the design, the flexibility and the fact that it encourages a nice idiomatic functional style.

Sample server:

(use 'compojure)

(defroutes my-app
  (GET "/index.html"
    (html 
      [:h1 "Hello World!!"]
      [:body "This is some text"]))
  (ANY "*"
    [404 "Page not found"]))

(run-server {:port 80}
  "/*" (servlet my-app))

Note that Compojure uses Ring internally.

彻夜缠绵 2024-07-19 03:38:22

我赞同雷恩关于小胡子的建议。

现在,我们正在使用Ring(基础层,中间件),Mustache(路由),Hiccup(html生成)。 我们刚刚开始使用 Compass for CSS (http://compass-style.org/)。 到目前为止,我对这个小型库的集合而不是一个大型的“完整堆栈”框架(Django、Rails 等)感到满意。

I second Rayne's recommendation on Moustache.

Right now, we are using Ring (base layer, middleware), Moustache (routing), Hiccup (html generation). We just began using Compass for CSS (http://compass-style.org/). So far, I'm happy with this collection of small libraries rather than a big "complete stack" framework (Django, Rails, ect...).

吝吻 2024-07-19 03:38:22

现在,还有一个名为 Noir 的新版本,它构建在 compojure 之上。 强烈推荐,尤其是 Heroku

Now, there is also a new one named Noir build on top of compojure. Really recommended, especially with Heroku.

迷迭香的记忆 2024-07-19 03:38:22

Compojure 目前似乎最受关注。 不一定代表质量,但眼睛最多的人可能进化得最快。

Compojure seems to be getting the most buzz right now. Not necessarily indicative of quality, but the one with the most eyes will probably evolve the fastest.

岁吢 2024-07-19 03:38:22

还有Moustache,这是我在尝试Clojure,以及 Ring。 太棒了。

There is also Moustache, which is what I use in TryClojure, along with Ring. It's pretty awesome.

牛↙奶布丁 2024-07-19 03:38:22

Compojure 基于 Ring,这是一个低级框架,不会尝试隐藏太多 HTTP。 它类似于 WSGI (Python) 或 Rack (Ruby)。 Ring 有一个中间件的概念,即可以对 HTTP 请求和/或响应执行一些有意义的操作的小代码片段,例如转储标头信息、管理 cookie 等。Compojure 是一个更高级别的框架,有点类似于 Ruby 的 Sinatra。 其目标是为 Web 应用程序开发人员面临的大多数任务提供方便的 API(或 DSL,如果您愿意)。 它通常与 HTML 生成库一起使用,例如 Hiccup。

在过去的几个月里,我对 Webjure 的了解不多,我不确定它是否正在积极开发(但我有兴趣了解更多信息)。 它先于 Ring、AFAICT,后者似乎已成为 Clojure Web 框架的某种标准。

Compojure is based on Ring, which is a low-level framework that doesn't attempt to hide much of HTTP. It's similar to WSGI (Python) or Rack (Ruby). Ring has a concept of middleware, small pieces of code that can do something meaningful with an HTTP request and/or response, such as dump header infos, manage cookies etc. Compojure is a higher-level framework, somewhat similar to Ruby's Sinatra. Its aim is to provide a convenient API (or DSL, if you prefer) for most tasks a Web app developer faces. It's usually used together with an HTML generation library, such as Hiccup.

I haven't heard much about Webjure in the last few months, I'm not sure it's in active development (but I'd be interested to find out more). It precedes Ring, AFAICT, which seems to have become somewhat of a standard for Clojure Web frameworks.

森罗 2024-07-19 03:38:22

我一直在使用 Compojure 构建一个供我自己使用的项目,效果非常好。 它实际上并没有太大的障碍,让您可以专注于重要的事情,即您的问题领域。 该项目大约有 1100 行 clojure,只是为了让您了解其规模。

I've been building a project for my own use using Compojure and it has worked out great. It doesn't really get in the way very much and lets you focus on what's important, your problem domain. The project is about 1100 lines of clojure just to give you an idea of the size.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文