Skip to content

Instantly share code, notes, and snippets.

@mmcgrana
Forked from anonymous/server.clj
Created January 8, 2012 22:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmcgrana/1579896 to your computer and use it in GitHub Desktop.
Save mmcgrana/1579896 to your computer and use it in GitHub Desktop.
http.server example
(ns http.server
(:require [vertx.http :as http]))
(def server (http/server))
(defn vertx-start
[]
(-> server
(http/on-request
(fn [req resp]
(println (str "Got request: " (:uri req)))
(println "Headers are:")
(doseq [[header-name header] (:headers req)]
(println (str header-name ":" header)))
(-> resp
(http/header "Content-Type" "text/html; charset=UTF-8")
(http/end "<html><body><h1>Hello from vert.x!</h1></body></html>"))))
(http/listen 8080)))
(defn vertx-stop
[]
(http/close server))
@mvasilkov
Copy link

Did you, by any chance, check how does the performance penalty compares to others (esp. Groovy)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment