Skip to content

Commit

Permalink
GH-40 Update in-place routing example
Browse files Browse the repository at this point in the history
  • Loading branch information
dzikoysk committed Nov 11, 2023
1 parent b610d59 commit 3296af9
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import io.javalin.community.routing.dsl.RoutingDslFactory
import io.javalin.community.routing.dsl.defaults.DefaultContextScopeConfiguration
import io.javalin.community.routing.dsl.defaults.DefaultDsl.DefaultScope
import io.javalin.community.routing.dsl.defaults.Path
import io.javalin.community.routing.dsl.examples.CustomDsl.CustomRoutingConfiguration
import io.javalin.community.routing.dsl.examples.CustomDsl.CustomScope
import io.javalin.community.routing.dsl.examples.ExampleDsl.CustomRoutingConfiguration
import io.javalin.community.routing.dsl.examples.ExampleDsl.CustomScope
import io.javalin.http.Context
import io.javalin.http.ExceptionHandler
import io.javalin.http.Handler

object CustomDsl : RoutingDslFactory<CustomRoutingConfiguration, DslRoute<CustomScope, Unit>, CustomScope, Unit> {
object ExampleDsl : RoutingDslFactory<CustomRoutingConfiguration, DslRoute<CustomScope, Unit>, CustomScope, Unit> {

// This is custom configuration class that will be used to register routes
open class CustomRoutingConfiguration : DefaultContextScopeConfiguration<DslRoute<CustomScope, Unit>, CustomScope, Unit>()
Expand Down Expand Up @@ -44,7 +44,7 @@ data class PandaPath(val age: Int)

fun main() {
Javalin.create { config ->
config.router.mount(DslRouting(CustomDsl)) {
config.router.mount(DslRouting(ExampleDsl)) {
it.before {
// `endpointHandlerPath` comes from Context class
result("Called endpoint: ${matchedPath()}")
Expand Down

0 comments on commit 3296af9

Please sign in to comment.