Running Server Application

    Table of contents:

    When you need to run a Ktor application in an independently maintained host (for instance Tomcat), you will need an fileto tell Ktor how to start your application.

    Replace my.company.MyApplication with your application’s package, and ApplicationKt with the name of thefile your Application.main function is contained in.

    Deploying the hosted application

    // TODO

    IntelliJ IDEA

    • Create a new Run Configuration using “Application” as a template
    • For the main class use one of the following engines
      • Netty: use
      • Jetty: use io.ktor.server.jetty.EngineMain
    • Specify the Module to be used

    See also: Configuration

    Ktor can automatically reload the application when changes to the class files are detected, i.e. when you build the Application.Enable this feature by adding watch configuration to application.conf:

    1. ktor {
    2. port = 8080
    3. watch = [ my.company ]
    4. }
    5. }