-
-
Save mmcgrana/1579896 to your computer and use it in GitHub Desktop.
http.server example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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
Did you, by any chance, check how does the performance penalty compares to others (esp. Groovy)?