Hi Hermant, are you running this at a REPL? What URL exactly are you going to (http://localhost:3032/ <http://localhost:3032/> should work if the server is running)? > On 27 Jul 2015, at 10:55, hemant gautam <[email protected]> wrote: > > On running the below mentioned code on browser I am getting "Page not found" > for each type of request. > Can anybody suggest me where I am doing a mistake. > > (ns currentday.core > (:require [compojure.core :refer :all] > [compojure.route :as route] > [compojure.handler :as handler] > [ring.middleware.defaults :refer :all] > [ring.util.response :refer :all]) > (:use ring.adapter.jetty)) > (defn now [] > (new java.util.Date)) > > (defn say-hello [] > "Hello!! everyone. I am home page of webservice.") > > (defn date-is [req] > "Today's date is: " (str (now))) > > (defn get-date [req] > (-> (response (date-is)) > (content-type "text/html"))) > > (defn add-data [a b] > (-> (response "Sum of two no. is: "(str (+ a b))) > (content-type "text/html"))) > > (defn sub-data [a b] > (-> (response "Subtraction of two no. is: "(str (- a b))) > (content-type "text/html"))) > > (defroutes my-routes > (GET "/" [] "Hello") > (GET "/date" req (get-date [req])) > (GET "/add/:a/:b" [a b] (add-data a b)) > (GET "/sub/:a/:b" [a b] (sub-data a b)) > (route/not-found "Page not found")) > > (def app > (handler/site my-routes)) > > (defonce server (run-jetty #'app {:port 3032 :join? false})) > > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to [email protected] > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > <http://groups.google.com/group/clojure?hl=en> > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>.
-- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
