All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.dev.programadorthi.routing.events.resources.EventResources.kt Maven / Gradle / Ivy

The newest version!
package dev.programadorthi.routing.events.resources

import dev.programadorthi.routing.core.application.Application
import dev.programadorthi.routing.core.application.BaseApplicationPlugin
import io.ktor.util.AttributeKey

/**
 * Adds support for type-safe event using [EventResourcesConfiguration].
 *
 * Example:
 * ```kotlin
 * @Event("event_name")
 * class DoSomething
 *
 * routing {
 *   event { doSomething ->
 *     // handle the event
 *   }
 * }
 * ```
 */
public object EventResources :
    BaseApplicationPlugin {
    override val key: AttributeKey = AttributeKey("EventResources")

    override fun install(
        pipeline: Application,
        configure: EventResourcesConfiguration.Configuration.() -> Unit,
    ): EventResourcesConfiguration {
        val configuration = EventResourcesConfiguration.Configuration().apply(configure)
        return EventResourcesConfiguration(configuration)
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy