I note that the stringtemplate-clj library defaults to using directory
paths only, but StringTemplate itself can pull templates from the
classpath as well. If you placed your templates in
"resources/templates" and used StringTemplate directly, you wouldn't
have to worry about where the template directory was.
Regarding your routes, they could be made a little more concise:
(defroutes all-routes
(GET "/" []
(pages/home))
(POST "/" [origin addresses]
(pages/list-distances origin addresses))
(route/not-found
(pages/not-found-404)))
And I'd avoid placing a run-jetty command in the same file your routes
are. Instead, run Jetty in the REPL, or use the "lein-ring" plugin:
https://github.com/weavejester/lein-ring
- James
On 2 January 2011 19:30, Alex Baranosky <[email protected]> wrote:
> Hello everyone,
> Sean Allen inspired me to share the web app I've been playing with to learn
> Compojure. It's codenamed Sportello and is a simple app that uses the
> Google Maps API to calculate an estimated amount of miles you'll have to
> travel from a certain place depending on where you live and how frequently
> you visit a list of other places.
> https://github.com/AlexBaranosky/Sportello/tree/master/src
> I used StringTemplate for my templating, and Midje for testing. One thing I
> could see doing is using some form of caching on my requests to google, so
> that the same request isn't sent to google over and over (they have a
> request limit). When I get inspired to, I want to add users and sessions,
> and save a user's data. Any direction here would be appreciated.
> To get it to run on your machine, in template.clj change the (def
> template-dir "C:\\dev\\sportellos\\templates") line to match the location of
> the templates folder in your clone of the project. Then just lein repl
> src/server.clj and go to localhost:8080
> Any comments on style, technique or just anythings I missed would be greatly
> appreciated. I'm really trying to expand my horizons and perfect the app as
> a kind of kata.
> Best,
> Alex
>
> --
> 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 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