Skip to content

Instantly share code, notes, and snippets.

/server.clj
Created Jan 8, 2012

Embed
What would you like to do?
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))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.