문제

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top