Migrating from 2.2.x to 3.0.x
This guide provides instructions on how to migrate your Ktor application from the 2.2.x version to 3.0.x.
Ktor Server
Locations plugin has been removed
The Locations
plugin for the Ktor server has been removed. To create type-safe routing, use the Resources plugin instead. This requires the following changes:
Replace the
io.ktor:ktor-server-locations
artifact withio.ktor:ktor-server-resources
.The
Resources
plugin depends on the Kotlin serialization plugin. To add the serialization plugin, see the kotlinx.serialization setup.Update the plugin import from
io.ktor.server.locations.*
toio.ktor.server.resources.*
.Additionally, import the
Resource
module fromio.ktor.resources
.
The following example shows how to implement these changes:
For more information on working with Resources
, refer to Type-safe routing.