![]() ![]() Start typing ktor-client, choose this action from the list, and press Enter. IntelliJ IDEA provides the ability to quickly add the HttpClient to your project: IntelliJ IDEA also allows you to generate code for plugins when creating a new project using the Add sample code option. IntelliJ IDEA generates code for the selected plugin and adds the required dependencies to the build script. Place the caret inside a module, start typing install and then choose the desired plugin from the list. IntelliJ IDEA allows you to generate code for Ktor plugins using the code completion popup: On the OpenAPI tab, you can see an OpenAPI specification for this route. If a Ktor server is running, you can make a request using the HTTP Client to see a response immediately or open it in the editor. In the invoked Endpoints tool window, you can see all the routes defined in your application. To see all HTTP or WebSocket endpoints defined in your Ktor application, use the Endpoints tool window:Ĭlick the icon next to the path and choose Show all endpoints of module from a popup. IntelliJ IDEA will show related paths/URLs: Show routes in the Endpoints tool window When a URL turns into a hyperlink, click it without releasing the key.Ĭlick the icon next to the path or URL and choose Go to declaration or usages from a popup. Keeping Control pressed, hover over the path or URL. Place the caret at the desired path or URL and press Control+B. To navigate between a route and its usages in a project, do one of the following: To narrow down your search, click the Filter icon on the window toolbar and select URLs. ![]() Press Shift twice to open the search window. To find a specific route in your application using Search everywhere, follow the steps below: Navigation Find routes with Search Everywhere You can learn the specifics of running server Ktor applications from the Running topic. This means that the server is ready to accept requests at the address. The Run tool window should show the following message: Wait until IntelliJ IDEA runs the application. To run the application from the editor, follow these steps:Ĭlick the gutter icon next to the main function and choose Run 'ApplicationKt'. To create the Ktor run configuration automatically for newly created or imported Ktor projects, use the Create Run Configuration automatically option on the Settings | Languages & Frameworks | Ktor page. ![]() Using the dedicated Ktor run configuration. Using a respective Gradle task or Maven goal. Using the gutter icon next to the main function. You can run a server Ktor application in one of the following ways: On the next page, you can choose a set of plugins - building blocks that provide common functionality of a Ktor application, such as authentication, serialization and content encoding, compression, cookie support, and so on.Ĭlick Create and wait until IntelliJ IDEA generates a project and installs the dependencies. You can also generate a plugin's code for the existing project using the completion popup. Ktor version: Choose the required Ktor version.Įngine: Select an engine used to run a server.Ĭonfiguration in: Choose whether to specify server parameters in code, in a HOCON or Yaml file.Īdd sample code: Use this option to add sample code for plugins, which will be added on the next page. Website: Specify a domain used to generate a package name.Īrtifact: This field shows a generated artifact name. This can be Gradle with Kotlin or Groovy DSL, or Maven. Location: Specify a directory for your project.īuild System: Choose the desired build system. On the right pane, you can specify the following settings: In the New Project wizard, choose Ktor from the list on the left. On the Welcome screen, click New Project. Migrating projects to the latest Ktor version. Generating tests for routes and adding sample code for Ktor plugins.Ĭode editing assistance, including completion and renaming route names. Navigating between routes across a project. IntelliJ IDEA provides the following capabilities for working with Ktor projects:Ī dedicated run configuration for running and debugging Ktor projects. It supports multiple platforms, including JVM, JavaScript, and Kotlin/Native. You can use it to create server-side as well as client-side applications. Ktor is a web application framework for creating connected systems.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |