Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@wsargent
Copy link
Member

@wsargent wsargent commented Aug 6, 2016

Fixes #4586

Describes SIRD routing in context of a conf/routes file and by extending SimpleRouter.

@wsargent wsargent changed the title Add SIRD routing documentation [doc] Add SIRD routing documentation Aug 6, 2016
@schmitch
Copy link
Contributor

schmitch commented Aug 6, 2016

Shouldn't we also add a @Inject parameter to it and describe that? That the Main Router will Inject stuff into the SIRD router?

@wsargent
Copy link
Member Author

wsargent commented Aug 8, 2016

@schmitch there's nothing to inject though...

@schmitch
Copy link
Contributor

schmitch commented Aug 8, 2016

yeah not here but it's possible but not documented.

@wsargent
Copy link
Member Author

wsargent commented Aug 8, 2016

@schmitch something like this?

class HomeRouter @Inject()(controller: HomeController)
  extends SimpleRouter
{
  override def routes: Routes = {
    case GET(p"/") =>
      val f = controller.index _
      f()
  }
}

@schmitch
Copy link
Contributor

schmitch commented Aug 8, 2016

yeah exactly but you dont need f()

override def routes: Routes = {
case GET(p"/") => controller.index
}

works

@wsargent wsargent force-pushed the doc-add-sird-binding branch from fdc8bbd to 9783177 Compare August 8, 2016 17:26
@wsargent
Copy link
Member Author

wsargent commented Aug 8, 2016

@schmitch okay done

@wsargent wsargent closed this Aug 8, 2016
@wsargent wsargent reopened this Aug 8, 2016
@wsargent
Copy link
Member Author

wsargent commented Aug 8, 2016

also added a note addressing #6107

@schmitch
Copy link
Contributor

schmitch commented Aug 8, 2016

yeah actually it not really addresses it.
it's still not easy to especially group multiple routers so that you can just skip the routes file.
we have like 20 subrouters and the syntax would really ugly with orElse, but I didn't found a good way how to handle it (yet) / it's not something I had prioritized high (probablly a good community issue).

But +1 I will merge as is if tests are green

@schmitch schmitch merged commit 962e68d into playframework:master Aug 8, 2016
schmitch pushed a commit that referenced this pull request Aug 8, 2016
* Add SIRD routing documentation

* Add code example with call out to a controller

* Add note about composing routers
@wsargent wsargent deleted the doc-add-sird-binding branch August 8, 2016 21:03
wsargent added a commit to wsargent/playframework that referenced this pull request Oct 25, 2016
* Add SIRD routing documentation

* Add code example with call out to a controller

* Add note about composing routers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants