No description
- Clojure 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| src/br/dev/ourivez | ||
| test/br/dev/ourivez | ||
| .gitignore | ||
| deps.edn | ||
| README.md | ||
Ourivez - jdk.httpserver adapter
Ring adapter for the built-in HTTP server in the JDK (Module jdk.httpserver)
ourivez/jdk.httpserver is a minimalistic wrapper that implements the Ring 2 protocol (the Clojure specification for web applications) on top of the standard JDK HTTP server. It allows you to run Ring handlers directly with a lightweight server, requiring no external dependencies—ideal for development, testing, and microservices. Motivation
-
Zero external dependencies – uses only the JDK; no need for libraries like Jetty or Netty.
-
Lightweight and fast – great for prototyping, health checks, and embedded applications.
-
Fully Ring2-compliant – works seamlessly with any existing Ring middleware.
Installation
br.dev.ourivez/jdk-httpserver {:git/url "..."}
Basic usage clojure
(require '[br.dev.ourivez.jdk-httpserver :as jdk-httpserver])
;; Simple Ring handler
(defn handler
[ring-request]
{:ring.response/status 200
:ring.response/headers {"Content-Type" "text/plain"}
:ring.response/body "Hello, world!"})
;; Start server on port 8080
(def server (jdk-httpserver/run-server handler {:server-port 8080}))
;; Stop the server
(.stop server 0)