scala - How to embed Play 2.6 using Akka HTTP Server? -


play 2.5 used netty default , allowed easy embedding. https://www.playframework.com/documentation/2.5.x/scalaembeddingplay

how done akka http server, default server backend?

the page https://www.playframework.com/documentation/2.6.x/scalaembeddingplay missing.

the documentation split in 2 pages:

  1. for akka http server: https://www.playframework.com/documentation/2.6.1/scalaembeddingplayakkahttp
  2. for netty server: https://www.playframework.com/documentation/2.6.1/scalaembeddingplaynetty

you should use akkahttpservercomponents avoid deprecated apis:

import play.api.{ builtincomponents, nohttpfilterscomponents } import play.api.mvc._ import play.api.routing.router import play.api.routing.sird._ import play.core.server.akkahttpservercomponents  val server = new akkahttpservercomponents builtincomponents nohttpfilterscomponents {    // avoid using deprecated action builder while   // keeping `action` idiom.   private val action = defaultactionbuilder    override def router: router = router.from {     case get(p"") => action {       results.ok("hello, world")     }   }   }.server 

Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -