Releases: programadorthi/kotlin-routing
2.0.0-alpha02
What's Changed
- Adding support to compile-time routes generator.
import dev.programadorthi.routing.generated.configure
@Route(path = "/create")
fun something() {
// ...
}
val router = routing {
configure()
}
router.call(uri = "/create")
More information checkout the Wiki.
Full Changelog: 2.0.0-alpha01...2.0.0-alpha02
2.0.0-alpha01
What's Changed
- Kotlin 2.0.10
- JVM Toolchain and Target from 8 to 11
- Wasm and Linux support
Full Changelog: 0.0.21...2.0.0-alpha01
0.0.21
What's changed
- This is a snapshot to 3.0.0-beta-1 and future fixes
- Next versions will be based on Ktor 3.0.0-beta-2 that brings Kotlin 2.0.0 and WASM support
Full Changelog: 0.0.20...0.0.21
0.0.20
What's new
- Fixed a limitation to type-safe routing from parent to child
Full Changelog: 0.0.19...0.0.20
0.0.19
What's new
- Kodein integration to retrieve instances inside route handle
handle(path = "/path") {
val name: Type by instance()
}
- Koin integration to retrieve instances inside route handle
handle(path = "/path") {
val name: Type by inject()
}
Full Changelog: 0.0.18...0.0.19
0.0.18
What's new
- Added
callWithBody
function that helps to call a route passing a custom body value.- Based on Ktor Handling request objects, to send or receive a body do:
router.handle(path = "...") { val body = call.receiveNullable<AnyKindValueType>() // or val body = call.receive<AnyKindValueType>() // throw an exception whether there is no value sent } // to sent a body router.callWithBody(uri = "...", body = AnyKindValue)
- Based on Ktor Handling request objects, to send or receive a body do:
- Added
canHandle*
functions that receive aRouteMethod
to check based on name or path combined with the provided method. - Added
RouteMethod
optional parameter toredirectTo*
functions to redirect to another name or path that haven't the same method.
Full Changelog: 0.0.17...0.0.18
0.0.17
0.0.16
Upgrades
- Compose Multiplatform 1.6.0
- Voyager 1.1.0-alpha03
Fixes
- 0.0.15 bugs
Full Changelog: 0.0.15...0.0.16
0.0.15
What's new
- State restoration and web history support to Compose and Voyager integrations
Bug known
- Voyager 1.0.0 has an
IrLinkageError
issue when running JS application. - It requires an upgrade to
1.1.0-alpha03
but it creates other issue that needandroidx.annotation:annotation
to publish. - Upgrades to compose and voyager will come in another version.
Full Changelog: 0.0.14...0.0.15
0.0.14
What is new
Routing Core
To check if a route is registered before invoking it, you can use Routing.canHandleByName
or Routing.canHandleByPath
methods, depending on how your routing is set up. These methods help determine if a given route name or path matches any registered routes, allowing you to handle navigation appropriately. lookUpOnParent
parameter helps with nested routing look up.
Routing Resources
Type-safe routing also received a support to check if a route is registered
JavaScript integration
Web applications has different history modes, specifically hash-based (/#/
) and HTML5 history API. These modes facilitate handling navigation history in single-page applications (SPAs).
- Hash-based Routing: In hash-based routing, the URL contains a hash fragment (
/#/
) followed by the route. This method doesn't trigger a full page reload when navigating between routes, making it suitable for SPAs. It's compatible with older browsers and doesn't require server-side configuration. - HTML5 History API: This API allows manipulating the browser history using JavaScript, enabling more natural-looking URLs without hash fragments. It's more modern and provides cleaner URLs but requires server-side configuration to handle URL requests properly.
- In-memory: Memory routing typically doesn't involve changing the URL and is often used in testing or scenarios where navigation doesn't need to be reflected in the browser's address bar.
Full Changelog: 0.0.13...0.0.14