Skip to content

Instantly share code, notes, and snippets.

@up1
Last active August 29, 2015 14:27
Show Gist options
  • Save up1/e00ab22b9e4bf06e8b06 to your computer and use it in GitHub Desktop.
Save up1/e00ab22b9e4bf06e8b06 to your computer and use it in GitHub Desktop.
Demo :: Web framework on JVM
(ns hello-world.handler
(:require [compojure.core :refer :all]
[compojure.route :as route]
[ring.middleware.defaults :refer [wrap-defaults site-defaults]]))
(defroutes app-routes
(GET "/" [] "Hello World")
(route/not-found "Not Found"))
(def app
(wrap-defaults app-routes site-defaults))
import org.scalatra._
import scalate.ScalateSupport
class HelloServlet extends HelloStack {
get("/") {
<html>
<body>
<h1>Hello, world!</h1>
Say <a href="hello-scalate">hello to Scalate</a>.
</body>
</html>
}
}
import static spark.Spark.get;
public class HelloSpark {
public static void main(String[] args) {
get("/hello", (req, res) -> "Hello World");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment