开发者

Does scalatra use circumflex behind the scenes?

Does scalatra use circumflex behind the scenes (or vise versa)? What are the key differences between them, and which one would you use?

Both frameworks are inspired by Sinatra and from a glance look开发者_如何学Go identical.

Request routing with scalatra:

class ScalatraExample extends ScalatraServlet {

get("/date/:year/:month/:day") {
  <ul>
    <li>Year: {params("year")}</li>
    <li>Month: {params("month")}</li>
    <li>Day: {params("day")}</li>
  </ul>
}

Sample code in circumflex:

class Main extends RequestRouter {

get("/posts/:id") = "Post #" + uri("id")

}
}


Ross A. Baker, one of the Scalatra developers, has recently commented on the difference between Circu,flex and Scalatra:

They are superficially very similar, though I think each has its strengths. Here are some differences that I see:

Templating: Scalatra integrates with Scalate, Circumflex integrates with Freemarker.

Routing: Circumflex has nicer sugar for header matching, but Scalatra lets you match on arbitrary booleans (i.e., global flag for site maintenance)

ORM: Circumflex has one, Scalatra doesn’t. I know of Scalatra users using Squeryl, Querulous, Scala-Query, ORMBroker, and, yes, Circumflex-ORM. These integrations are trivial, and I assume would also be trivial with Circumflex.

Auth: Scalatra has an auth module in its latest snapshot, Circumflex does not.

i18n: Circumflex has sugar for message bundles, Scalatra does not.

Testing: Scalatra also includes a nice DSL for testing; I’m not aware of anything similar for Circumflex.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜