1. 程式人生 > >Ktor 1.0 Released: A Connected Applications Framework by JetBrains

Ktor 1.0 Released: A Connected Applications Framework by JetBrains

As we work on Kotlin, we implement many features that help build idiomatic and high-performing APIs. We’ve been dreaming of seeing a Web framework that utilizes these features to the max. Today, we can finally say we’ve built that kind of framework! Please welcome Ktor, which has just reached 1.0.

Ktor is a Kotlin framework for building asynchronous servers and clients in connected systems. It is being created by the Kotlin team, and as such, it takes full advantage of the language in order to provide a great developer experience and excellent runtime performance.

Ktor

Ktor is built from the ground up using coroutines, which make it possible to express complex asynchronous constructs as if they were simple sequential code. Coroutines are also quite efficient at runtime. In addition, the use of Kotlin features allows us to provide a domain-specific language (DSL)

— a concise and developer-friendly API for configuring your application with no magic, just code.

Of course, Ktor is not the only option for building server-side applications in Kotlin. We’re pleased to see that other frameworks such as Spring and Vert.x are providing first-class support for Kotlin, and using these frameworks is a great way to preserve your existing investment and experience. At the same time, Ktor offers unique advantages thanks to its use of coroutines and DSLs, which makes it a great option when you’re starting a new backend project or a microservice.

Ktor is already deployed in production in a number of projects running at scale. For example, HLTV.org serves about 200 million pageviews per month and about 3.1 billion pageviews in total on Ktor. The latest release of the ThoughtWorks Technology Radar lists Ktor in their Assess category.

What’s Included

The two main parts of Ktor are the HTTP server framework, running on the JVM, and the multiplatform HTTP client. As a JetBrains project, Ktor naturally comes with helpful tools to get you started with new projects quickly.

Server

The HTTP server part is built upon proven technologies like Netty, Jetty, and also Java servlets. When using lightweight engines like Netty or Jetty, it starts ultrafast and is ready to receive connections in under a second. It is compatible with the 12 Factors paradigm, is container-friendly, and can easily be embedded into desktop (or even Android) applications. You can also run it in an application server such as Tomcat.

Ktor provides a rich and easy-to-use extensibility mechanism, on top of which most of the built-in functionality is implemented. Third-party features look no different from the built-in ones. Out of the box, Ktor includes all the essential features like sessions, authentication, JSON serialization, popular template engines, Web sockets, metrics, and many others. It also supports a productive development workflow, with a fast start, automatic reloading, and easy-to-use facilities for writing unit and integration tests.

Client

The client part is asynchronous as well, built using the same coroutines and IO primitives that drive the server. This makes it perfect for building asynchronous microservice architectures, connecting all the backend functionality into asynchronous pipelines.

The client is implemented as a multiplatform library, which currently supports JVM, JS, Android, and iOS. This makes it possible to retrieve data on mobile devices and web pages in a uniform way, without blocking application execution or building complex chains of anonymous functions to handle successes or failures.

Tools

Last but not least, the tools let you select the features you need and get a fully working starter app with Ktor. This works both on the Web and via a plugin for IntelliJ IDEA.

Like all other Kotlin libraries, Ktor is free and open-source, developed on GitHub and released under the Apache 2 license.

Getting Started

The Hello World of Ktor is small enough to fit in a tweet:

To go beyond that, the website provides a Quickstart guide, extensive documentation for writing servers and clients, and many sample projects. If you prefer videos, Ryan Harter’s KotlinConf 2018 talk is a great introduction to using Ktor on the backend.

Hop over to https://start.ktor.io/ to get a project template, check out the docs, and your new backend will be up and running in no time! If you need help, the friendly folks on the #ktor channel on Kotlin Slack are there for you.

Have a nice Ktor!

相關推薦

Ktor 1.0 Released: A Connected Applications Framework by JetBrains

As we work on Kotlin, we implement many features that help build idiomatic and high-performing APIs. We’ve been dreaming of seeing a Web frame

慶祝 Ktor 1.0 釋出,分享 JetBrains 日講稿及程式碼

本文也發在我的個人部落格上:https://hltj.me/kotlin/2018/11/22/ktorcn-update-jetbrains-day-slides.html 。 非常值得慶祝的是,Ktor 1.0 正式釋出了,Ktor 中文站也已更新。   &nbs

Qt Design Studio 1.0 Released

We believe that collaboration between designers and developers in an effective workflow fosters a

postgis-2.0.dll": %1 is not a valid Win32 application解決方案

下載地址: 連結: https://pan.baidu.com/s/1qLrmqEoFdvf4n9vkw-RSxw 密碼: 63l2 參考部落格: https://blog.csdn.net/atzhangzt/article/details/69788102?locationNu

WARN [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f9a88c968b8c94ba9781b49897989e9

這些日子為這個錯誤苦惱很久了,網上找到的各種方法都試了一遍,還是沒能解決。 安裝好zookeeper後,執行zkServer.sh start 顯示正常啟動,但執行zkServer.sh status 則顯示:Error contacting service. It is probably not runn

讀書筆記: C# 7.0 in a nutshell (第 五 章 Framework Overview)

內容: 第五章 框架總覽 Overview .NET Standard 2.0 CLR 和核心框架 應用技術 1. Overview 幾乎所有 .NET 框架的作用都通過一系列的 Managed Types暴露出

VScode 1.13 gocode提示dial tcp 216.239.37.1:443: connectex: A connection attempt failed because the connected..

在將VScode升級至 1.13後讓升級gocode,在升級時報出如下錯誤 D:\go_work\src>go get -u -v github.com/mdempsky/gocode github.com/mdempsky/gocode (download) Fetching http

Uncaught DOMException: Blocked a frame with origin "http://127.0.0.1" from accessing a cross-origin

我瀏覽自己tomcat上網頁用的localhost,訪問的子頁面用的127.0.0.1, 所以只要瀏覽器中的localhost改為127.0.0.1就好了 下面是別人出現的類似錯誤,敲黑板,做筆記。 iframe子頁面呼叫父頁面方法 跨域 異常 Blocked a

Linux下$#,$0,$1,$2,$3,<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="bc98fc">[email protected]a>,$*,$$,$?代表的含義

$# :傳給指令碼的引數個數; $0 :指令碼名稱; $n :n為數字,代表傳給指令碼的第n個引數; [email protected] :引數列表; $* :也是顯示引數列表,與上一條命

Ceph v12.1.0 Luminous RC released

ceph L 版本終於出了一個候選release版本。來看看都有哪些新功能吧。 本文摘自個人部落格,更多幹貨,也詳見該部落格:夏天的風 v12.1.0 Luminous RC released 這是Luminous的第一個候選版本,下一個長期

Oracle removed JRE 10.0.2 download and released a broken Java 10.0.99 update

The Java preference panel in macOS just notified me that there's an update to Java 10 (supposedly version 10.0.99). I proceeded to "update", but it didn't

Datumbox Machine Learning Framework 0.7.0 Released

I am really excited to announce tha

Datumbox Machine Learning Framework 0.6.0 Released

The new version of Datumbox Machin

騰訊雲遊戲語音gcloud voice demo,Unity 5.1打包IOS自動新增CoreTelephony.framework和libstdc++.6.0.9.tbd

效果和手動新增相同 在Assets\Editor下隨便建立一個cs檔案: public class IosBuildScript : UnityEngine.MonoBehaviour { [UnityEditor.Callbacks.PostProcessBuild(

Releasing ptop 1.0 : A task manager written using Python

Releasing ptop 1.0 : A task manager written using PythonThis blog post is about one of my open source project called ptop. ptop is a task manager for Linux

一個數組a[0...n-1],求a[i]-a[j]的最大值,其中i>j

其實這道題有O(n)的方法。 第一種方法: 左往右求下標1到 k - 1 的最大值MAX右往左求 下標k到n -1 的最小值MIN 對於每個k都有一個MAX - MIN的值,最後求這個值的最大值即可。 比如4 5 2 6 3 1 MAX 4 4 2 2 2 MIN 1 3

【Python】給定一個數組A[0,…,n-1],求A的連續子陣列,使得該子陣列的和最大

最大子陣列 給定一個數組A[0,…,n-1],求A的連續子陣列,使得該子陣列的和最大。 例如陣列: 1, -2, 3, 10, -4, 7, 2, -5 最大子陣列:3, 10, -4, 7, 2 演算法分析 定義:字首和sum[i

centos7.3 安裝scrapy出錯Could not find a version that satisfies the requirement Twisted>=13.1.0

1錯誤原因,通過pip install 安裝scrapy是報錯Could not find a version that satisfies the requirement Twisted>=13.1.0 (from Scrapy) (from versi

向量圖形引擎庫VectorDraw Developer Framework更新至v7.7014.1.0丨附下載

VectorDraw Developer Framework(VDF)是一款構建2D、3D圖形並用於應用程式視覺化的向量圖形引擎庫。有了VDF提供的功能,您可以輕鬆地建立、編輯、管理、輸出、輸入和列