2020-11-25 08:08:45 +00:00
|
|
|
package dev.inmo.postssystem.core.ktor.server.content
|
2020-08-14 06:06:37 +00:00
|
|
|
|
2020-11-25 08:08:45 +00:00
|
|
|
import dev.inmo.postssystem.core.content.api.ContentRepo
|
|
|
|
import dev.inmo.postssystem.core.ktor.contentRootRoute
|
2020-11-25 07:53:15 +00:00
|
|
|
import dev.inmo.micro_utils.ktor.server.configurators.ApplicationRoutingConfigurator
|
2020-08-14 06:06:37 +00:00
|
|
|
import io.ktor.routing.Route
|
|
|
|
import io.ktor.routing.route
|
|
|
|
|
|
|
|
fun Route.configureContentRepoRoutes(
|
|
|
|
proxyTo: ContentRepo
|
|
|
|
) {
|
|
|
|
route(
|
|
|
|
contentRootRoute
|
|
|
|
) {
|
|
|
|
configureReadContentRepoRoutes(proxyTo)
|
|
|
|
configureWriteContentRepoRoutes(proxyTo)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class ContentRepoRoutingConfigurator(
|
|
|
|
private val proxyTo: ContentRepo
|
|
|
|
) : ApplicationRoutingConfigurator.Element {
|
|
|
|
override fun Route.invoke() {
|
|
|
|
configureContentRepoRoutes(proxyTo)
|
|
|
|
}
|
|
|
|
}
|