Refactor
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package starter.modules
|
||||
|
||||
import org.http4k.core.then
|
||||
import org.http4k.filter.ServerFilters
|
||||
import org.http4k.routing.ResourceLoader
|
||||
import org.http4k.routing.routes
|
||||
import org.http4k.routing.static
|
||||
import org.koin.dsl.bind
|
||||
import org.koin.dsl.module
|
||||
import starter.routes.IndexRouteSupplier
|
||||
import starter.routes.RouteSupplier
|
||||
import starter.routes.ZipRouteSupplier
|
||||
import starter.routes.toRouter
|
||||
|
||||
val routesModule = module {
|
||||
single { IndexRouteSupplier(get()) } bind RouteSupplier::class
|
||||
single { ZipRouteSupplier(get(), get()) } bind RouteSupplier::class
|
||||
single {
|
||||
ServerFilters.CatchAll().then(
|
||||
routes(
|
||||
static(ResourceLoader.Classpath("/assets")),
|
||||
getAll<RouteSupplier>().toRouter()
|
||||
))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user