Creates an PekkoHttpServer from a given router using BuiltInComponents:
val server = PekkoHttpServer.fromRouterWithComponents(ServerConfig(port = Some(9002))) { components =>
import play.api.mvc.Results._
import components.{ defaultActionBuilder => Action }
{
case GET(p"/") => Action {
Ok("Hello")
}
}
}
Use this together with Sird Router.
Attributes
- Companion
- class
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
PekkoHttpServer.type
Members list
Type members
Classlikes
The values needed to initialize an PekkoHttpServer.
The values needed to initialize an PekkoHttpServer.
Value parameters
- actorSystem
-
An ActorSystem that the server can use.
- appProvider
-
An object which can be queried to get an Application.
- config
-
Basic server configuration values.
- stopHook
-
A function that should be called by the server when it stops. This function can be used to close resources that are provided to the server.
Attributes
- Companion
- object
- Supertypes
Value members
Concrete methods
Create a Pekko HTTP server from the given application and server configuration.
Create a Pekko HTTP server from the given application and server configuration.
Value parameters
- application
-
The application.
- config
-
The server configuration.
Attributes
- Returns
-
A started Pekko HTTP server, serving the application.
Inherited methods
Creates a Server from the given router, using ServerComponents.
Creates a Server from the given router, using ServerComponents.
Value parameters
- config
-
the server configuration
- routes
-
the routes definitions
Attributes
- Returns
-
an PekkoHttpServer instance
- Inherited from:
- ServerFromRouter (hidden)
Deprecated and Inherited methods
Creates a Server from the given router.
Creates a Server from the given router.
Value parameters
- config
-
the server configuration
- routes
-
the routes definitions
Attributes
- Returns
-
an PekkoHttpServer instance
- Deprecated
- true
- Inherited from:
- ServerFromRouter (hidden)
Implicits
Implicits
A ServerProvider for creating an PekkoHttpServer.
A ServerProvider for creating an PekkoHttpServer.