Development mode
Ktor provides a special mode targeted for development. This mode enables the following capabilities:
Auto-reload for reloading application classes without restarting the server.
Extended information for debugging pipelines (with stack traces).
Extended debugging information on a response page in a case of a 5** server error.
Enable development mode
You can enable development mode in different ways: in the application configuration file, using a dedicated system property, or environment variable.
Configuration file
To enable development mode in a configuration file, set the development
option to true
:
The 'io.ktor.development' system property
The io.ktor.development system property allows you to enable development mode when running your application.
To run an application in development mode using IntelliJ IDEA, pass io.ktor.development
with the -D
flag to VM options:
If you run your application using a Gradle task, you can enable development mode in one of two ways:
Configure the
ktor
block in your build.gradle.kts file:ktor { development = true }Enable development mode for a single run by passing a Gradle CLI flag:
./gradlew run -Pio.ktor.development=true
The 'io.ktor.development' environment variable
To enable development mode for a Native client, use the io.ktor.development
environment variable.