Getting started with Ktor
Home > getting-started-with-ktor

Ktor REST APIs

With this example you will be developing your own REST APIs with Kotlin.




Let's start and create a new project in IntelliJ IDEA (Ultimate)

Enter all the required text, and click next button



Search for routing plugin, and click on Add button then Finish button.

It will take some time to set up the workspace for the first time.


Once Sync is complete, add required dependency in build.gradle


Open your Routing.kt file it must be similar to below code


Create a kotlin file with UserController name, and code snnipet as below:


Modify the code snnipet of Application.kt file as below:



Now, let's run the App

Once it's running successfully, check the response on browser by hitting this URL

Note: if you see nothing is loading, check what port you are running your app.