← 返回命令列表

Linux command

ktor 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Create a new project

ktor new

Create with specific plugins

ktor new --plugins [routing,content-negotiation,ktor-serialization]

Create with custom name

ktor new --name [myapp]

Generate with Gradle Kotlin DSL

ktor new --build-system gradle-kotlin

List available plugins

ktor plugins list

Search for plugins

ktor plugins search [auth]

Show version

ktor --version

说明

ktor is the CLI for Ktor, a Kotlin framework for building asynchronous servers and clients. It scaffolds new projects with selected features. ktor new generates a project with build files, application configuration, and plugin setup. Plugins add functionality like authentication, serialization, and WebSockets. Ktor applications configure features in Application.kt using DSL. Plugins are installed in modules: install(ContentNegotiation), install(Authentication), etc. The framework runs on multiple engines: Netty, Jetty, Tomcat, or CIO (Kotlin coroutines). Choose based on requirements—Netty is default for production. Configuration via HOCON (application.conf) or YAML specifies ports, hosts, and plugin settings. Environment variables override configuration values.

FAQ

What is the ktor command used for?

ktor is the CLI for Ktor, a Kotlin framework for building asynchronous servers and clients. It scaffolds new projects with selected features. ktor new generates a project with build files, application configuration, and plugin setup. Plugins add functionality like authentication, serialization, and WebSockets. Ktor applications configure features in Application.kt using DSL. Plugins are installed in modules: install(ContentNegotiation), install(Authentication), etc. The framework runs on multiple engines: Netty, Jetty, Tomcat, or CIO (Kotlin coroutines). Choose based on requirements—Netty is default for production. Configuration via HOCON (application.conf) or YAML specifies ports, hosts, and plugin settings. Environment variables override configuration values.

How do I run a basic ktor example?

Run `ktor new` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

Where can I find more ktor examples?

This page includes 7 examples for ktor, plus related commands for nearby Linux tasks.