Skip to content

Instantly share code, notes, and snippets.

@julienrf
Last active December 27, 2015 16:09
Show Gist options
  • Select an option

  • Save julienrf/7352749 to your computer and use it in GitHub Desktop.

Select an option

Save julienrf/7352749 to your computer and use it in GitHub Desktop.
Play with control
object Main extends App {
// You can retrieve the application configuration from any place
val configuration = Configuration("conf/my-app.conf")
// You instantiate your controllers with their required configuration
val application = new MyAbstractController(configuration) with SomeEventualMixin
// You pass your controllers as parameters to a router factory
val router = Router("conf/routes", application)
// You finally create the server
createServer(router, configuration)
}
object Main extends App {
// For convenience, the createServer method could have default values for its parameters
// so the line below would be equivalent to the following:
// createServer(Router("conf/routes"), Configuration("conf/application.conf"))
createServer()
}
// For even more convenience, we could have a PlayApp trait which body would contain the following:
// createServer()
object Main extends PlayApp
@mandubian
Copy link
Copy Markdown

... and this approach wouldn't prevent current integrated approach where "basic" users wouldn't care about it.

@brikis98
Copy link
Copy Markdown

brikis98 commented Nov 7, 2013

This is awesome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment