server
The elide-server
module provides support for server apps built with the Elide Framework on JVM.
Built with Micronaut
By default, the server implementation used by Elide is based on Micronaut, and underneath that, Netty. This is a very fast and lightweight combination, and it's also very easy to use.
This also means you can use most of the Micronaut modules with your Elide server app out of the box, such as:
Installation
The elide-server
package is provided via 0, and also via Elide's own 1 repository.
Via Gradle (Catalog):
implementation(framework.elide.server)
Via Gradle (Kotlin DSL):
implementation("dev.elide:elide-server")
Via Gradle (Groovy DSL):
implementation "dev.elide:elide-server"
Via Maven:
<dependency>
<groupId>dev.elide</groupId>
<artifactId>elide-server</artifactId>
</dependency>
Getting Started
All of the main 2 use the elide-server
package. Here is a barebones example (3):
/** Self-contained application example, which serves an HTML page that says "Hello, Elide!". */
object App {
/** GET `/`: Controller for index page. */
@Page(name = "index") class Index : PageController() {
@Get("/") suspend fun index() = html {
head {
title { +"Hello, Elide!" }
}
body {
strong { +"Hello, Elide!" }
}
}
}
/** Main entrypoint for the application. */
@JvmStatic fun main(args: Array<String>) {
build().args(*args).start()
}
}
This particular sample is embedded within the Elide codebase, and can be run with:
./gradlew -PbuildSamples=true :samples:server:helloworld:run
Server Features
Implemented with 4 and Netty
Opinionated Micronaut and Netty defaults for interactive web-facing applications
Integration with 5 for static asset management and SSR
Supports content negotiation, ETags, conditional responses
Intelligent build-time compression support (Brotli, Gzip, etc.)
Execute JavaScript, Python, Ruby, and other languages via Elide's SSR tools
Share objects between languages for SSR calls