Take a tuple with path and method for controller
Take a tuple with path and method for controller
delete0[Controller]( ("show" / IntNumber) ~> "my_method")
transform to
pathPrefix("show" / IntNumber) { num => delete { controller.my_method(num) } }
- your controller
path and method for controller
Route
Take an action which use as route path.
Take an action which use as route path.
- your controller
use as route and as method for controller
Route
Take a tuple with path and method for controller
Take a tuple with path and method for controller
get0[Controller]( ("show" / IntNumber) ~> "my_method")
transform to
pathPrefix("show" / IntNumber) { num => get { controller.my_method(num) } }
- your controller
path and method for controller
Route
Take an action which use as route path.
Take an action which use as route path.
- your controller
use as route and as method for controller
Route
Take a path with method for handle request, with list of http methods.
Take a path with method for handle request, with list of http methods.
match0[Controller](("show" / IntNumber) ~> "my_method", List(GET, DELETE))
transform to
pathPrefix("show" / IntNumber) { num => get { controller.my_method(num) } ~ delete { controller.my_method(num) } }
- you controller type
path with method for handle request.
- a list with http methods for handle request.
Route
Take a path with method for handle request.
Take a path with method for handle request. By default use spray.http.HttpMethods.GET for http method.
match0[Controller](("show" / IntNumber) ~> "my_show")
transform to
pathPrefix("show" / IntNumber) { num => get { controller.my_show(num) } }
- you controller
Route
Take a method.
Take a method. And provide transformation into route.
match0[Controller]("index", List(GET, DELETE))
Will be transform:
pathPrefix("index") {
get {
controller.index
} ~
delete {
controller.index
}
}
- use as method from controller and path for request.
- a list with http methods for handle request.
Route
Take a method.
Take a method. And provide tranformation into route. By default use spray.http.HttpMethods.GET for request.
match0[Contoller]("index")
Will be transform:
pathPrefix("index") {
get {
controller.index
}
}
- you controller type
information about method. This method will be use as route path.
Route
Take a tuple with path and method for controller
Take a tuple with path and method for controller
post0[Controller]( ("show" / IntNumber) ~> "my_method")
transform to
pathPrefix("show" / IntNumber) { num => post { controller.my_method(num) } }
- your controller
path and method for controller
Route
Take an action which use as route path.
Take an action which use as route path.
- your controller
use as route and as method for controller
Route
Take an action which use as route path.
Take an action which use as route path. ANd excluded arguments, when excluded is present, then form transform to Map[String, Any], otherwise create a new Model instance.
case class Model(id: Int, title: Option[String] = None) trait HttpFormController extends BaseController { import HttpService._ def post(m: Model10) = { //got a Model(10, Some("spray")) } def another(m: Map[String, Any]) = { //got a Map("title" -> "spray") } } postForm[HttpFormController, Model10]("another", "id") ~ postForm[HttpFormController, Model10]("post" ~> "post") Post("/another", FormData(Seq("title" -> "spray"))) Post("/post", FormData(Seq("id" -> "10", "title" -> "spray")))
- your controller
- you model
use as route and as method for controller
excluded arguments
Route
Take a tuple with path and method for controller
Take a tuple with path and method for controller
put0[Controller]( ("show" / IntNumber) ~> "my_method")
transform to
pathPrefix("show" / IntNumber) { num => put { controller.my_method(num) } }
- your controller
path and method for controller
Route
Take an action which use as route path.
Take an action which use as route path.
- your controller
use as route and as method for controller
Route
Define resource with subroute, block and excluded methods.
Define resource with subroute, block and excluded methods.
resource[Controller, Method](exclude("show"), { pathPrefix("/path") { complete{ "path" } } }, IntNumber)
- list of excluded methods
- nested route block
- part of route, which will be pass into controller method, and use for create a url
Define resource with subroute and nexted block
Define resource with subroute and nexted block
resource[Controller, Model](IntNumber, { pathPrefix("/path") { get { complete { "path" } } } }
- Controller
- Model
- part of route, which will be pass into controller method
- nested route block, and use for create a url
Route
Define resource with specified subroute
Define resource with specified subroute
resource[Controller, Model](exclude("show"), Segment)
- Controller
- Model
- list of excluded methods
- part of route, which will be pass into controller method, and use for create a url
Route
Simple define routes
Simple define routes
resource[Controller, Model]
- you controller
- you model
Route
Define routes without excluded actions, and nested block
Define routes without excluded actions, and nested block
resource[Controller, Model](exclude("index"), { get0[Controller]("other") })
- you controller
- you model
- excluded actions
Route - nested block
Route
Define routes with nested block
Define routes with nested block
resource[Controller, Model] {
get0[Controller]("other")
}
- you controller
- you model
Route - block with nested routes
Route
Define routes without excluded pathes.
Define routes without excluded pathes.
resource[Controller, Model](exclude("index", "show", "new"))
- you controller
- you model
- list with excluded methods (index, show, ...)
Route
A root path
A root path
root[Controller]("root")
transform to
pathPrefix("") { controller.root }
- you controller type
- a controller method.
Route
Method for create
Method for create
scope("scope") { pathPrefix("foo") { get { complete("wow") } }
transform to
pathPrefix("scope") { //you block }
string for path
- block of routes
Route
(routable: StringAdd).self
(routable: StringFormat).self
(Since version 1.0-M8/1.1-M8) Use Segment
instead
(routable: ArrowAssoc[Routable]).x
(Since version 2.10.0) Use leftOfArrow
instead
(routable: Ensuring[Routable]).x
(Since version 2.10.0) Use resultOfEnsuring
instead
Trait contatin methods for resource implementation. With resource method you might quick create routes for you controller. Also map form information onto Model.
transform to
Note: for
new
method in controller usefresh
name.