Running as a Helidon Níma server


Helidon Níma requires JDK supporting Project Loom threading (JDK21 or newer).

To expose an endpoint as a Helidon Níma server, first add the following dependency:

"com.softwaremill.sttp.tapir" %% "tapir-nima-server" % "1.10.1"

Loom-managed concurrency uses direct style instead of effect wrappers like Future[T] or IO[T]. Because of this, Tapir endpoints defined for Nima server use Id[T], which provides compatibility, while effectively means just T.

Such endpoints are then processed through NimaServerInterpreter in order to obtain an io.helidon.webserver.http.Handler:

import io.helidon.webserver.WebServer
import sttp.tapir._
import sttp.tapir.server.nima.{Id, NimaServerInterpreter}

val helloEndpoint = endpoint.get
  .serverLogicSuccess[Id] { _ =>
    "hello, world!"

val handler = NimaServerInterpreter().toHandler(List(helloEndpoint))

  .routing { builder =>