Base trait used to define services. Defines the service route bean used by [AkkaHttpServerAutoConfiguration].
This trait is designed to be stackable, allowing multiple services to be implemented in a single server.
Usage: Extend this trait and override the route function to create your service.
Example: Note the use of abstract override and the concatenation of super.route to make the service stackable.
// Define the service route in traittrait EchoService extends AkkaHttpService {
abstractoverridedef route: Route = {
get {
path("echo" / Segment) { name =>
complete(name)
}
}
} ~ super.route
}
// Implement the trait in your application configuration
@Configuration
@Import(Array(classOf[AkkaHttpServerAutoConfiguration]))
class Configuration extends EchoService
Base trait used to define services. Defines the service route bean used by [AkkaHttpServerAutoConfiguration].
This trait is designed to be stackable, allowing multiple services to be implemented in a single server.
Usage: Extend this trait and override the route function to create your service.
Example: Note the use of
abstract override
and the concatenation ofsuper.route
to make the service stackable.