changeset 106:5b0753c6f34d laserkard tip

updated to newest compojure and a simpler syntax
author Robert McIntyre <rlm@mit.edu>
date Mon, 27 Sep 2010 20:22:58 -0400
parents 3c398dd94f17
children
files buy_temp.clj common.clj faq.clj server.clj
diffstat 4 files changed, 16 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/buy_temp.clj	Mon Sep 27 17:47:08 2010 -0400
     1.2 +++ b/buy_temp.clj	Mon Sep 27 20:22:58 2010 -0400
     1.3 @@ -1,9 +1,7 @@
     1.4  (ns laserkard.buy-temp
     1.5  
     1.6 -  (:use (compojure.http request servlet session routes)
     1.7 -	(compojure.server jetty)
     1.8 -	(compojure control)
     1.9 -	(clojure.contrib def prxml str-utils duck-streams)
    1.10 +  (:use (clojure.contrib def prxml
    1.11 +			 [str-utils :only [re-gsub]] )
    1.12  	(laserkard common)
    1.13  ))
    1.14  
     2.1 --- a/common.clj	Mon Sep 27 17:47:08 2010 -0400
     2.2 +++ b/common.clj	Mon Sep 27 20:22:58 2010 -0400
     2.3 @@ -1,8 +1,5 @@
     2.4  (ns laserkard.common
     2.5 -    (:use (compojure.http request servlet session routes)
     2.6 -	(compojure.server jetty)
     2.7 -	(compojure control)
     2.8 -	(clojure.contrib prxml str-utils duck-streams)))
     2.9 +    (:use (clojure.contrib prxml)))
    2.10  
    2.11  
    2.12  (defn pxml [ & args] 
     3.1 --- a/faq.clj	Mon Sep 27 17:47:08 2010 -0400
     3.2 +++ b/faq.clj	Mon Sep 27 20:22:58 2010 -0400
     3.3 @@ -1,8 +1,5 @@
     3.4  (ns laserkard.faq
     3.5 -  (:use (compojure.http request servlet session routes)
     3.6 -	(compojure.server jetty)
     3.7 -	(compojure control)
     3.8 -	(clojure.contrib prxml str-utils duck-streams seq-utils)
     3.9 +  (:use (clojure.contrib prxml [str-utils :only [re-gsub]] [seq-utils :only [indexed]] )
    3.10  	(laserkard common)))
    3.11  
    3.12  (def faqs 
     4.1 --- a/server.clj	Mon Sep 27 17:47:08 2010 -0400
     4.2 +++ b/server.clj	Mon Sep 27 20:22:58 2010 -0400
     4.3 @@ -1,22 +1,24 @@
     4.4  (ns laserkard.server
     4.5 -  (:use (compojure.http request servlet session routes)
     4.6 -	(compojure.server jetty)
     4.7 -	(compojure control)
     4.8 -	(laserkard buy-temp faq)
     4.9 +  (:use
    4.10 +   [compojure core]
    4.11 +   [ring.adapter jetty]
    4.12 +   [laserkard buy-temp faq])
    4.13 +  )
    4.14  
    4.15 -))
    4.16 -
    4.17 -(defroutes example
    4.18 +(defroutes laserkard
    4.19    (GET "/index.clj" [] "<h1> hello, connie, good to meet you</h1>")
    4.20    (GET "/buy-temp.clj" [] (buy-gen))
    4.21    (GET "/faq.clj" [] (faq))
    4.22  )
    4.23  
    4.24 +(defn serve []
    4.25 +  (future
    4.26 +   (run-jetty (var laserkard.server/laserkard) {:port 9000 :host "localhost"})))
    4.27  
    4.28  
    4.29 -(defserver laserkard-server
    4.30 -  {:port 9000 :host "localhost"}
    4.31 -  "/*" (servlet example))
    4.32 +;(defserver laserkard-server
    4.33 +;  {:port 9000 :host "localhost"}
    4.34 +;  "/*" (servlet example))
    4.35  
    4.36  
    4.37