构建异步服务器和客户端的 Kotlin 框架 Ktor

码农软件 · 软件分类 · Web框架 · 2019-03-24 07:27:15

软件介绍

Ktor 是一个使用 Kotlin 以最小的成本快速创建 Web 应用程序的框架。

Ktor 是一个用于在连接系统(connected systems)中构建异步服务器和客户端的 Kotlin 框架。它由 Kotlin 团队创建,因此,它充分利用了 Kotlin 的语言特性,为开发者提供出色的体验和运行时性能。

import io.ktor.server.netty.*
import io.ktor.routing.*
import io.ktor.application.*
import io.ktor.http.*
import io.ktor.response.*
import io.ktor.server.engine.*
fun main(args: Array<String>) {
    embeddedServer(Netty, 8080) {
        routing {
            get("/") {
                call.respondText("Hello, world!", ContentType.Text.Html)
            }
        }
    }.start(wait = true)
}

在 localhost:8080 上运行嵌入式 Web 服务器

当收到根路径的 GET http 请求时,安装路由并收到 Hello, world! 响应

本文地址:https://codercto.com/soft/d/2025.html

Head First Mobile Web

Head First Mobile Web

Lyza Danger Gardner、Jason Grigsby / O'Reilly Media / 2011-12 / $ 50.84

Despite the huge number of mobile devices and apps in use today, your business still needs a website. You just need it to be mobile. Head First Mobile Web walks you through the process of making a con......一起来看看 《Head First Mobile Web》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

html转js在线工具
html转js在线工具

html转js在线工具