Slide 19
Slide 19 text
Server System as a function
class EcommerceSystem(env: Environment, clock: Clock, events: Events, theInternet: HttpHandler) : HttpHandler {
private val networkAccess = NetworkAccess()
private val apiGateway = ApiGateway(env, clock, events, networkAccess)
private val shop = ShopApi(env, clock, events, networkAccess)
private val warehouse = WarehouseApi(env, clock, events, networkAccess, Inventory.InMemory(events, clock))
init {
networkAccess.http = routes(
reverseProxyRouting(
env[API_GATEWAY_URL].authority to apiGateway,
env[SHOP_URL].authority to shop,
env[WAREHOUSE_URL].authority to warehouse
),
Router.orElse bind theInternet,
)
}
override fun invoke(request: Request) = networkAccess(request)
}
http://api-gateway/order/
ECOMMERCE
SYSTEM