Popularity
8.2
Declining
Activity
0.0
Stable
988
34
43
Programming language: Kotlin
License: Apache License 2.0
Tags:
Web
Latest version: v1.0.0-alpha
spark-kotlin alternatives and similar libraries
Based on the "Web" category.
Alternatively, view spark-kotlin alternatives based on common mentions on social networks and blogs.
-
javalin
DISCONTINUED. A simple and modern Java and Kotlin web framework [Moved to: https://github.com/javalin/javalin] -
apollo-android
:rocket: A strongly-typed, caching GraphQL client for the JVM, Android, and Kotlin multiplatform. -
http4k
The Functional toolkit for Kotlin HTTP applications. http4k provides a simple and uniform way to serve, consume, and test HTTP services. -
skrape.it
A Kotlin-based testing/scraping/parsing library providing the ability to analyze and extract data from HTML (server & client-side rendered). It places particular emphasis on ease of use and a high level of readability by providing an intuitive DSL. It aims to be a testing lib, but can also be used to scrape websites in a convenient fashion. -
hexagon
Hexagon is a microservices toolkit written in Kotlin. Its purpose is to ease the building of services (Web applications or APIs) that run inside a cloud platform. -
firefly
Firefly is an asynchronous web framework for rapid development of high-performance web application. -
tekniq
A framework designed around Kotlin providing Restful HTTP Client, JDBC DSL, Loading Cache, Configurations, Validations, and more -
bootique-kotlin
DISCONTINUED. RETIRED. Provides extension functions and features for smooth development with Bootique and Kotlin. -
Pellet
An opinionated, Kotlin-first web framework that helps you write fast, concise, and correct backend services 🚀. -
Zeko-RestApi
Asynchronous web framework for Kotlin. Create REST APIs in Kotlin easily with automatic Swagger/OpenAPI doc generation -
komock
KoMock - Simple HTTP/Consul/SpringConfig http server framework written in Kotlin. Wiremock use cases -
voyager-server-spring-boot-starter
Easily create REST endpoints with permissions (access control level) and hooks includeded
CodeRabbit: AI Code Reviews for Developers
Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
Promo
coderabbit.ai

* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of spark-kotlin or a related project?
README
spark-kotlin
A Spark DSL in idiomatic kotlin.
Authors:
- Per Wendel, @perwendel
- Love Löfdahl, @lallemupp
Dependency:
Maven:
<dependency>
<groupId>com.sparkjava</groupId>
<artifactId>spark-kotlin</artifactId>
<version>1.0.0-alpha</version>
</dependency>
Gradle:
compile "com.sparkjava:spark-kotlin:1.0.0-alpha"
Documentation
Routes
// Static API
get("/hello") {
"Hello Spark Kotlin"
}
get("/doc") {
// available (same in instance API)
params()
params("<path-param-name>")
splat()
status()
status(404)
queryParams("<key>")
queryMap()
queryMap("<key>")
attribute("<key>")
attribute("<key>", "<value>")
attributes()
session()
session(create = true)
contentType()
uri()
protocol()
scheme()
host()
port()
pathInfo()
servletPath()
contextPath()
userAgent()
requestMethod()
type()
type(contentType = "application/json")
redirect(location = "/to")
redirect(location = "/to", statusCode = 302)
// has all above and some more
request
response
}
get("/nothing") {
status(404)
"Oops, we couldn't find what you're looking for"
}
get("/saymy/:name") {
params(":name")
}
get("/redirect") {
redirect("/hello")
}
// Instance API
val http = ignite()
http.get("/hello") {
"Hello Spark Kotlin"
}
http.get("/nothing") {
status(404)
"Oops, we couldn't find what you're looking for"
}
http.get("/saymy/:name") {
params(":name")
}
http.get("/redirect") {
redirect("/hello")
}
Initialization DSL
// Static API
config {
port = 5500
ipAddress = "0.0.0.0"
threadPool {
maxThreads = 10
minThreads = 5
idleTimeoutMillis = 1000
}
secure {
keystore {
file = "/etc/secure/keystore"
password = "hardtocrack"
}
truststore {
file = "/etc/secure/truststore"
password = "otherdifficultpassword"
}
needsClientCert = false
}
staticFiles {
location = "/public"
expiryTime = 36000.seconds
headers(
"description" to "static content",
"licence" to "free to use"
)
mimeTypes(
"cxt" to "text/html"
)
}
}
// Instance API
val http = ignite {
port = 5500
ipAddress = "0.0.0.0"
threadPool {
maxThreads = 10
minThreads = 5
idleTimeoutMillis = 1000
}
secure {
keystore {
file = "/etc/secure/keystore"
password = "hardtocrack"
}
truststore {
file = "/etc/secure/truststore"
password = "otherdifficultpassword"
}
needsClientCert = false
}
staticFiles {
location = "/public"
expiryTime = 36000.seconds
headers(
"description" to "static content",
"licence" to "free to use"
)
mimeTypes(
"cxt" to "text/html"
)
}
}
Redirect DSL
// Static API
redirect {
any(
"/from" to "/hello",
"/hi" to "/hello"
)
get(
"/source" to "/target"
)
post(
"/gone" to "/new"
)
}
// Instance API
http.redirect {
any(
"/from" to "/hello",
"/hi" to "/hello"
)
get(
"/source" to "/target"
)
post(
"/gone" to "/new"
)
}
WebSocket DSL (design ongoing)
// Static API
webSocket("/echo") {
opened {
println("[Opened] remote address = " + session.remoteAddress)
}
received {
println("[Received] message = $message")
}
closed {
println("[Closed] code = $code, reason = $reason, session = $session")
}
error {
println("[Error] cause = " + cause)
}
}
// Instance API
http.webSocket("/echo") {
opened {
println("[Opened] remote address = " + session.remoteAddress)
}
received {
println("[Received] message = $message")
}
closed {
println("[Closed] code = $code, reason = $reason, session = $session")
}
error {
println("[Error] cause = " + cause)
}
}
class WebSocketSession
val remote
var idleTimeout
val isOpen
val localAddress
val protocolVersion
val upgradeResponse
val upgradeRequest
val policy
val isSecure
val remoteAddress
fun disconnect()
fun suspend(): Suspension
fun close()
fun close(closeStatus: CloseStatus?)
fun close(statusCode: Int, reason: String?)
fun raw(): Session