And here is the simple example "Hello from Vert.x!" like other languages on 
the Vert.x official frontpage:

(ns examples.simple-http-server)

(require
 '[io.vertx.clojure.core.core :as core]
 '[io.vertx.lang.clojure.vertx :as vertx]
 '[io.vertx.lang.clojure.http-server :as server]
 '[io.vertx.lang.clojure.http-server-request :as request]
 '[io.vertx.lang.clojure.http-server-response :as response])

(defn handle-request [req]
  do
  (def response (request/response req))
  (response/put-header response "content-type" "text/plain")
  (response/end response"Hello from Vert.x!"))

(defn start [vertx]
  do
  (def http-server (vertx/create-http-server vertx))
  (server/request-handler http-server (core/handler handle-request))
  (server/listen http-server 8080))

Pretty straight forward, but we could make it better
e.g. combine different namespaces into one single would be nice 
and we got pure functions in different namespaces 
hmmm...., it looks nice.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to