webjure vs compojure?

后端 未结 8 1365
囚心锁ツ
囚心锁ツ 2021-02-13 22:28

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

相关标签:
8条回答
  • 2021-02-13 22:46

    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.

    0 讨论(0)
  • 2021-02-13 22:47

    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.

    0 讨论(0)
  • 2021-02-13 22:50

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

    0 讨论(0)
  • 2021-02-13 22:56

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

    0 讨论(0)
  • 2021-02-13 23:01

    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.

    0 讨论(0)
  • 2021-02-13 23:02

    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...).

    0 讨论(0)
提交回复
热议问题