Trinity is a lightweight MVC framework based on Finagle, which can be described in Scala.
- We provide functions about MVC which does not support Finagle.
- We support Domain Driven-Design by non CoC(Convention over Configuration).
- You can describe Actions over a Controller as a Finagle Service.
- Routing information can described to action methods, like Scalatra.
- Or, The Routing information can be aggregated on the outside of Controller, like Play2.
- You can use Template Engine (such as Scalatra) with Trinity.
- Routing request to action
- A action can be described as asynchronous process by using
com.twitter.util.Future. - Or, You can also select action as synchronous process by using
com.twitter.util.FuturePool. - We support an action adaptor for a process which returns
scala.concurrent.Future.
- A action can be described as asynchronous process by using
- Finagle's Request/Response Enhance
- multi-part file upload
- json format reponse
- file resouce support
- Binding to Template Engine
- Testing
- Unit testing
- Integration testing
- JRebel support
- see this gist for installation. https://gist.github.com/j5ik2o/5660744
- Functions for Form, Validation
- Functions for Persistence(sush as RDBMS/NoSQL)
Please add configuration in following to Build.scala.
object AppBuild extends Build {
val root = Project(
id = "app",
base = file("."),
settings = Project.defaultSettings ++ Seq(
resolvers ++= Seq(
// ...
"Sisioh Trinity Release Repository" at "http://sisioh.github.io/trinity/repos/release/",
// ...
),
libraryDependencies ++= Seq(
// ...
"org.sisioh" %% "trinity" % "0.0.7",
// ...
)
)
)
}val config = Config.fromFile()
implicit val application = TrinityApplication(config)
application.registerController(new GreetingController)
application.start() class GreetingController(implicit application: TrinityApplication) extends SimpleController {
get("/hello") {
request =>
responseBuilder.withPlain("Hello!").toFinagleResponseFuture
}
}class GreetingController(implicit application: TrinityApplication) extends AbstractController {
def hello = FutureAction {
request =>
responseBuilder.withPlain("Hello!").toFinagleResponseFuture
}
}Please modify bootstrap for routing to Play2 like controler.
// ...
implicit val application = TrinityApplication(config)
val greetingController = new GreetingController
application.addRoute(Method.Get, "/hello", greetingController, greetingController.hello)
application.registerController(greetingController)
// ...$ sbt clean compile$ sbt run$ curl -X GET http://localhost:7070/hello
Hello!