Created
January 29, 2011 14:12
-
-
Save laczoka/801856 to your computer and use it in GitHub Desktop.
This file contains 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
============== project.clj ================ | |
(defproject sampleweb "1.0.0-SNAPSHOT" | |
:description "sample application" | |
:dependencies [[org.clojure/clojure "1.2.0"] | |
[org.clojure/clojure-contrib "1.2.0"] | |
[compojure "0.6.0-RC1"]] | |
:dev-dependencies [[lein-ring "0.2.6"]] | |
:ring { :handler sampleweb.core/app-routes } | |
) | |
============== src/sampleweb/core.clj ====== | |
(ns sampleweb.core | |
(:require [compojure.route :as route]) | |
(:use [compojure.core :only [defroutes GET]])) | |
(defroutes handler | |
(GET "/" [] "OK") | |
(route/resources "/")) | |
(defn wrap-servlet-path-info [handler] | |
(fn [request] | |
(if-let [servlet-req (:servlet-request request)] | |
(handler (assoc request :path-info (.getPathInfo servlet-req))) | |
(handler request)))) | |
(def app-routes (-> handler | |
wrap-servlet-path-info)) | |
======== resources/public/index.html ============= | |
<html><body>this is index.html</body></html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment