-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Kotlin Blueprints
By :

Our project is ready with the required project structure, and Gradle dependency and configuration. Now it's time to write the application code.
In Ktor, there are two ways to configure the application parameters:
It's recommended to use a configuration file, because with configuration files, if you change any of the parameters later, then you won't need to recompile the code in future as there is no change in the Kotlin code. You'll only need to restart the application on the server.
Hence, we create a configuration file named application.conf
in the main/resources
directory of our project with the following content:
ktor { deployment { port = 8080 } application { modules = [ com.news.ApplicationKt.main ] } }
The deployment block contains configuration, such as port numbers, auto-reload, and so on.
The application block is an important...