Compojure-api, spec-tools, swagger,

2018-05-14 Thread Dave Tenny
I'm using compojure-api 2.0.0-alpha19, spec-tools 0.6.1, and trying to 
generate swagger pages with :spec coercion in compojure-api.

I know this is a work in progress but I'm not an expert in any of these 
tools and thought I'd ask here before I write pesky and likely incorrect 
issues in the Metosin repos.  I've done a fair bit of prismatic-schema 
enabled compojure-api and so was trying to translate some of that into a 
spec-ized implementation.  However i've either made a ton of mistakes 
(quite likely), or there's a lot of bugs, I'm not sure.

The following code fragments and annotated image show some of the problems 
I'm seeing.  Advice welcome. 

Basic specs, later aliased via 'db-jobs':

(s/def ::job-id nat-int?)
(s/def ::job-type #{:this-job :that-job :the-other-job})

Specs built on the above, later aliased via 'specs' in compojure-api 
declarations:
(s/def ::job-id  
  (st/spec ::db-jobs/job-id
   {:description "Specifies a Job ID, must be accompanied by a Firm 
ID for any valid use."}))


(s/def ::job-type 
  (st/spec ::db-jobs/job-type
   {:description "Specifies the type of job to be dispatched to a 
suitable worker service node."}))


(s/def ::firm-id
  (st/spec nat-int? 
   {:description "Specifies a Firm ID in the service database, or 
zero if there there is no specific firm."}))

Compojure-api code using the above three specs:

...
  (:require
   [clojure.spec.alpha :as s]
   [compojure.api.core :as api-core]
   [compojure.api.sweet :as sweet]
   [compojure.route :as route]
   [my.specs :as specs]
   [spec-tools.core :as st]

...
(sweet/defroutes routes
  (sweet/POST "/job/:firm-id" []
{:summary  "Enqueue a job"
 :description  "Enqueue a job."
 :path-params [firm-id :- ::specs/firm-id]
 :body-params [job-type :- ::specs/job-type]
 :responses   {201 {:description "Job enqueued." :schema ::specs/job-id}
   400 {:description "Invalid job type." 
:schema (st/spec string? {:description "Value of 
the unsupported job-type argument."})
}}}
{:status 201 :body (impl/create-job! firm-id job-type)}))

...
  (sweet/api
   {:coercion :spec
:swagger {:data {;;:basePath "/"
 :info {:title "Job Scheduler"
:description "Jobs"
:version 1
:contact {:name  "Pizza Eaters Inc." ...}}}
  :ui "/docs/swagger"
  :spec "/docs/swagger.json"
  :options {:ui {:docExpansion "list"

The resulting swagger page (fragment) follows, annotated for discussion:

<https://lh3.googleusercontent.com/-caIoOltcD_s/WvnkJRmrGDI/Mnc/8DGLbjWPqr4kAWh1i2kFN976fWwCZNAOACLcBGAs/s1600/swagger2.png>


   1. For the Response Class presentation, it would be nice to get the 
   description shown with the ::job-id type.
   2. The 'job-type' parameter name is not shown.
   3. The description of the 'job-type' parameter is not shown.
   4. The 201 response code data is missing from Response messages.
   5. (not highlighted)   :firm-id works as expected, whether it's because 
   it's a :path-param or because it lacks the same degree of indirection in 
   its spec definition I don't know.


Also note that
:path-params [firm-id :- (sweet/describe ::specs/firm-id "Firm identifier, 
or zero if there is no firm.")]
Does not produce a description in swagger, however the spec.tools code in 
the initial compojure-api code I presented works.  Bug or feature? (Seems 
like sweet/describe might be deprecated as we move to clojure.spec if we're 
using spec-tools).


Anyway, tips appreciated, and patience for obvious "user" mistakes.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: compojure ring uberwar weblogic 12.1.3

2017-01-08 Thread Jose Trigueros
Hi Samuel,

I just had to create a web application that was to be run on Weblogic 
12.2.1. I was able to get it working doing the following:


   1. Create a new project using *compojure-api* 
   <https://github.com/metosin/compojure-api>: lein new compojure-api webapp
   2. Use the *lein-ring* plugin (included with the compojure-api template) 
   to create WAR file, you may need to configure the plugin in the *project.clj 
   *to set the uberwar-name: lein ring uberwar
   3. Deploy WAR file

Doing this approach, I didn't have to touch the web.xml or weblogic.xml. 
You can configure the rest of the settings via the Weblogic Console. There 
were a few things that I couldn't get sorted out, any route that serves 
HTML craps out like this:

https://github.com/luminus-framework/luminus/issues/165


I ended up splitting my application in two, one WAR for the service and 
another for the static HTML/JS.


I hope this helps, it took me a lot of trial and error before figuring this 
out (I too tried the web.xml and weblogic.xml route).


-jvt

On Tuesday, December 13, 2016 at 9:24:41 AM UTC-7, Samuel Morello wrote:
>
> Dear all, 
>
> Is there someone who has experience with the deployment of web application 
> using compojure on a weblogic server ? 
> I  cannot make it run and could not find a similar issue. 
>
> I use: 
> lein ring uberwar to create the war file and have set some properties in 
> the project.clj file {:servlet-name, ... }. 
> I've also add a weblogic.xml inside the war to "exclude" joda.time, ... 
> but this doesn't work and i always have a 
> 403 forbidden error from weblogic. 
> I d'ont know if it is the good place to post this but any information 
> would help me a lot
> I can post the web.xml or weblogic.xml and project.clj if needed
> Many thanks, 
>
> Samuel 
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


compojure ring uberwar weblogic 12.1.3

2016-12-13 Thread Samuel Morello
Dear all, 

Is there someone who has experience with the deployment of web application 
using compojure on a weblogic server ? 
I  cannot make it run and could not find a similar issue. 

I use: 
lein ring uberwar to create the war file and have set some properties in 
the project.clj file {:servlet-name, ... }. 
I've also add a weblogic.xml inside the war to "exclude" joda.time, ... but 
this doesn't work and i always have a 
403 forbidden error from weblogic. 
I d'ont know if it is the good place to post this but any information would 
help me a lot
I can post the web.xml or weblogic.xml and project.clj if needed
Many thanks, 

Samuel 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: using the same middleware (wrap-multipart-params) with different parameters in one app [ring] [compojure]

2016-08-15 Thread Michael Drago
I ran into this SAME issue today. Did you ever find a solution? Even 
looking into ring's code it seems like it always takes the :store fn first 
and if one isn't defined it takes the default-store.

https://github.com/ring-clojure/ring/blob/1.5.0/ring-core/src/ring/middleware/multipart_params.clj#L108

On Friday, April 4, 2014 at 1:39:23 AM UTC-4, K Livingston wrote:
>
> I'm trying to dynamically handle the InputStream in file uploads 
> (ring/compojure app via servlet/jetty).  I started with two different 
> versions of the wrap-multipart-params, one is basically a NoOp that just 
> returns the file name, and the other echoes the file back.  They both work 
> fine independently but when I try to bring them both online together, which 
> ever store is defined first is the one I see called regardless of handler.
>
> Can I only have one copy of wrap-multipart-params in the whole app?
>
> How can I change how the InputStream is handled depending on the handler?
>
> Do I need to just have the handler return the IO stream and then change 
> the behavior in each handler function?
>
> example:
> The logging store is called even with POST to /upload-echo.  The echo 
> store is never called.
>
> (defroutes file-list-routes
>   (GET "/list-content"  request (file-list/show-file-list request))
>
>   (GET "/upload-logging" request 
>(upload/simple-upload-file "upload-logging" request))
>   (mp/wrap-multipart-params 
>(POST "/upload-logging" request (upload/upload-logging-file request))
>{:store upload/logging-store})
>
>   (GET "/upload-echo" request 
>(upload/simple-upload-file "upload-echo" request))
>   (mp/wrap-multipart-params 
>(POST "/upload-echo" request (upload/upload-echo-file request))
>{:store upload/echo-store})
>
>   );end route list
>
> These routes are then nested into some other context calls and of course 
> other middleware, until eventually making it up to the servlet.  There are 
> no other calls to wrap-multipart-params in my application.
>
> Thanks for your help,
> Kevin
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can't extract multipart-params from POST request in compojure

2016-07-06 Thread aaarturozhao
You are right! I didn't set the boundary in my client code. Thanks a lot!

在 2016年7月7日星期四 UTC+8下午12:46:04,James Reeves写道:
>
> By "application" I mean "Ring handler".
>
> Your request looks wrong. The boundary you set in your header 
> (--BoUnDaRyFF) doesn't match the boundary I see in the body 
> (--2n639DJeu...).
>
> - James
>
> On 7 July 2016 at 05:29, > wrote:
>
>> The request  header:
>>
>>
>>
>> <https://lh3.googleusercontent.com/-zl6jkFm15Pc/V33X-i2KFzI/AAM/c5zfE6Vn8qEHIZ3EInJed3HhKaFlFaINACLcB/s1600/%25E5%25B1%258F%25E5%25B9%2595%25E5%25BF%25AB%25E7%2585%25A7%2B2016-07-07%2B12.11.55.png>
>>
>> The request body:
>>
>>
>> <https://lh3.googleusercontent.com/-1Kca-9uDPeI/V33Ye1MImfI/AAQ/SyACY6OPidcw8Z3s42XYKEu9OyGb6-HNQCLcB/s1600/%25E5%25B1%258F%25E5%25B9%2595%25E5%25BF%25AB%25E7%2585%25A7%2B2016-07-07%2B12.15.19.png>
>>
>> My test params are: 
>>
>> String[] tags = {"", "", ""};
>> s = test.upload("/Users/apple/test.txt", tags, "19960808", 
>> "qwertyuiopasdfghjklzxcvbnm");
>>
>>
>> The content of test.txt is "This is a test...".
>>
>>
>> Is there anything wrong?
>>
>>
>> BTW, could you give me an example of the definition of app? I'm not sure 
>> which one is correct.
>>
>>
>> 在 2016年7月7日星期四 UTC+8上午10:30:31,James Reeves写道:
>>>
>>> In all your examples except for possibly the last, you have the 
>>> multipart middleware added twice over to your application.
>>>
>>> Also, are you sure it's not a problem with your client code?
>>>
>>> One thing to try is recording your HTTP request by pointing your client 
>>> at a netcat listener (e.g. "nc -l 3000"). Or writing a handler that dumps 
>>> out the headers and the contents of the request body.
>>>
>>> - James
>>>
>>> On 7 July 2016 at 03:18,  wrote:
>>>
>>>> This is the link to the question in stackoverflow:
>>>>
>>>> http://stackoverflow.com/questions/38226276/cant-extract-multipart-params-from-post-request-in-compojure
>>>>
>>>> 在 2016年7月7日星期四 UTC+8上午10:13:25,aaartu...@gmail.com写道:
>>>>
>>>>> When I try to extract the multipart-params from a POST request like 
>>>>> this:
>>>>>
>>>>> (defroutes upload-routes
>>>>>   (POST "/upload" {params :params} (println params))
>>>>>
>>>>>
>>>>> I got {}.
>>>>>
>>>>> Then I tried like this:
>>>>>
>>>>> (defroutes upload-routes
>>>>>   (POST "/upload" {multipart-params :multipart-params} (println 
>>>>> multipart-params))
>>>>>
>>>>> I still got {}.
>>>>>
>>>>> I guess there are something wrong about my middleware.
>>>>>
>>>>> So I tried to change the handler, here are the handlers I had tried:
>>>>>
>>>>> (ns cloudserver.handler
>>>>>   (:require [compojure.core :refer [defroutes routes]]
>>>>> [compojure.route :as route]
>>>>> [compojure.handler :as handler]
>>>>> [cloudserver.routes.home :refer [home-routes]]
>>>>> [noir.util.middleware :as noir-middleware]
>>>>> [cloudserver.routes.auth :refer [auth-routes]]
>>>>> [cloudserver.routes.upload :refer [upload-routes]]
>>>>> [cloudserver.routes.search :refer [search-routes]]
>>>>> [cloudserver.routes.download :refer [download-routes]]
>>>>> [ring.middleware.defaults :refer [api-defaults wrap-defaults 
>>>>> site-defaults]]
>>>>> [ring.middleware.multipart-params :refer 
>>>>> [wrap-multipart-params]]
>>>>> [ring.middleware.params :refer [wrap-params]]
>>>>> [noir.session :as session]
>>>>> [ring.middleware.session.memory :refer [memory-store]]))
>>>>>
>>>>> (def app
>>>>>   (->
>>>>>(routes auth-routes
>>>>>home-routes
>>>>>upload-routes
>>>>>search-routes
>>>>>download-routes
>>>>>

Re: Can't extract multipart-params from POST request in compojure

2016-07-06 Thread James Reeves
By "application" I mean "Ring handler".

Your request looks wrong. The boundary you set in your header
(--BoUnDaRyFF) doesn't match the boundary I see in the body
(--2n639DJeu...).

- James

On 7 July 2016 at 05:29,  wrote:

> The request  header:
>
>
>
> <https://lh3.googleusercontent.com/-zl6jkFm15Pc/V33X-i2KFzI/AAM/c5zfE6Vn8qEHIZ3EInJed3HhKaFlFaINACLcB/s1600/%25E5%25B1%258F%25E5%25B9%2595%25E5%25BF%25AB%25E7%2585%25A7%2B2016-07-07%2B12.11.55.png>
>
> The request body:
>
>
> <https://lh3.googleusercontent.com/-1Kca-9uDPeI/V33Ye1MImfI/AAQ/SyACY6OPidcw8Z3s42XYKEu9OyGb6-HNQCLcB/s1600/%25E5%25B1%258F%25E5%25B9%2595%25E5%25BF%25AB%25E7%2585%25A7%2B2016-07-07%2B12.15.19.png>
>
> My test params are:
>
> String[] tags = {"", "", ""};
> s = test.upload("/Users/apple/test.txt", tags, "19960808",
> "qwertyuiopasdfghjklzxcvbnm");
>
>
> The content of test.txt is "This is a test...".
>
>
> Is there anything wrong?
>
>
> BTW, could you give me an example of the definition of app? I'm not sure
> which one is correct.
>
>
> 在 2016年7月7日星期四 UTC+8上午10:30:31,James Reeves写道:
>>
>> In all your examples except for possibly the last, you have the multipart
>> middleware added twice over to your application.
>>
>> Also, are you sure it's not a problem with your client code?
>>
>> One thing to try is recording your HTTP request by pointing your client
>> at a netcat listener (e.g. "nc -l 3000"). Or writing a handler that dumps
>> out the headers and the contents of the request body.
>>
>> - James
>>
>> On 7 July 2016 at 03:18,  wrote:
>>
>>> This is the link to the question in stackoverflow:
>>>
>>> http://stackoverflow.com/questions/38226276/cant-extract-multipart-params-from-post-request-in-compojure
>>>
>>> 在 2016年7月7日星期四 UTC+8上午10:13:25,aaartu...@gmail.com写道:
>>>
>>>> When I try to extract the multipart-params from a POST request like
>>>> this:
>>>>
>>>> (defroutes upload-routes
>>>>   (POST "/upload" {params :params} (println params))
>>>>
>>>>
>>>> I got {}.
>>>>
>>>> Then I tried like this:
>>>>
>>>> (defroutes upload-routes
>>>>   (POST "/upload" {multipart-params :multipart-params} (println 
>>>> multipart-params))
>>>>
>>>> I still got {}.
>>>>
>>>> I guess there are something wrong about my middleware.
>>>>
>>>> So I tried to change the handler, here are the handlers I had tried:
>>>>
>>>> (ns cloudserver.handler
>>>>   (:require [compojure.core :refer [defroutes routes]]
>>>> [compojure.route :as route]
>>>> [compojure.handler :as handler]
>>>> [cloudserver.routes.home :refer [home-routes]]
>>>> [noir.util.middleware :as noir-middleware]
>>>> [cloudserver.routes.auth :refer [auth-routes]]
>>>> [cloudserver.routes.upload :refer [upload-routes]]
>>>> [cloudserver.routes.search :refer [search-routes]]
>>>> [cloudserver.routes.download :refer [download-routes]]
>>>> [ring.middleware.defaults :refer [api-defaults wrap-defaults 
>>>> site-defaults]]
>>>> [ring.middleware.multipart-params :refer 
>>>> [wrap-multipart-params]]
>>>> [ring.middleware.params :refer [wrap-params]]
>>>> [noir.session :as session]
>>>> [ring.middleware.session.memory :refer [memory-store]]))
>>>>
>>>> (def app
>>>>   (->
>>>>(routes auth-routes
>>>>home-routes
>>>>upload-routes
>>>>search-routes
>>>>download-routes
>>>>app-routes)
>>>>session/wrap-noir-session
>>>>(wrap-defaults(assoc-in site-defaults [:security :anti-forgery] false)
>>>>wrap-multipart-params
>>>>wrap-params))
>>>> (def app
>>>>   (->
>>>>(routes auth-routes
>>>>home-routes
>>>>upload-routes
>>>>search-routes
>>>>download-routes
>>>>app-routes)
>>>>session/wrap-noir-

Re: Can't extract multipart-params from POST request in compojure

2016-07-06 Thread aaarturozhao


The request  header:


<https://lh3.googleusercontent.com/-zl6jkFm15Pc/V33X-i2KFzI/AAM/c5zfE6Vn8qEHIZ3EInJed3HhKaFlFaINACLcB/s1600/%25E5%25B1%258F%25E5%25B9%2595%25E5%25BF%25AB%25E7%2585%25A7%2B2016-07-07%2B12.11.55.png>

The request body:

<https://lh3.googleusercontent.com/-1Kca-9uDPeI/V33Ye1MImfI/AAQ/SyACY6OPidcw8Z3s42XYKEu9OyGb6-HNQCLcB/s1600/%25E5%25B1%258F%25E5%25B9%2595%25E5%25BF%25AB%25E7%2585%25A7%2B2016-07-07%2B12.15.19.png>

My test params are: 

String[] tags = {"", "", ""};
s = test.upload("/Users/apple/test.txt", tags, "19960808", 
"qwertyuiopasdfghjklzxcvbnm");


The content of test.txt is "This is a test...".


Is there anything wrong?


BTW, could you give me an example of the definition of app? I'm not sure 
which one is correct.


在 2016年7月7日星期四 UTC+8上午10:30:31,James Reeves写道:
>
> In all your examples except for possibly the last, you have the multipart 
> middleware added twice over to your application.
>
> Also, are you sure it's not a problem with your client code?
>
> One thing to try is recording your HTTP request by pointing your client at 
> a netcat listener (e.g. "nc -l 3000"). Or writing a handler that dumps out 
> the headers and the contents of the request body.
>
> - James
>
> On 7 July 2016 at 03:18, > wrote:
>
>> This is the link to the question in stackoverflow:
>>
>> http://stackoverflow.com/questions/38226276/cant-extract-multipart-params-from-post-request-in-compojure
>>
>> 在 2016年7月7日星期四 UTC+8上午10:13:25,aaartu...@gmail.com写道:
>>
>>> When I try to extract the multipart-params from a POST request like this:
>>>
>>> (defroutes upload-routes
>>>   (POST "/upload" {params :params} (println params))
>>>
>>>
>>> I got {}.
>>>
>>> Then I tried like this:
>>>
>>> (defroutes upload-routes
>>>   (POST "/upload" {multipart-params :multipart-params} (println 
>>> multipart-params))
>>>
>>> I still got {}.
>>>
>>> I guess there are something wrong about my middleware.
>>>
>>> So I tried to change the handler, here are the handlers I had tried:
>>>
>>> (ns cloudserver.handler
>>>   (:require [compojure.core :refer [defroutes routes]]
>>> [compojure.route :as route]
>>> [compojure.handler :as handler]
>>> [cloudserver.routes.home :refer [home-routes]]
>>> [noir.util.middleware :as noir-middleware]
>>> [cloudserver.routes.auth :refer [auth-routes]]
>>> [cloudserver.routes.upload :refer [upload-routes]]
>>> [cloudserver.routes.search :refer [search-routes]]
>>> [cloudserver.routes.download :refer [download-routes]]
>>> [ring.middleware.defaults :refer [api-defaults wrap-defaults 
>>> site-defaults]]
>>> [ring.middleware.multipart-params :refer 
>>> [wrap-multipart-params]]
>>> [ring.middleware.params :refer [wrap-params]]
>>> [noir.session :as session]
>>> [ring.middleware.session.memory :refer [memory-store]]))
>>>
>>> (def app
>>>   (->
>>>(routes auth-routes
>>>home-routes
>>>upload-routes
>>>search-routes
>>>download-routes
>>>app-routes)
>>>session/wrap-noir-session
>>>(wrap-defaults(assoc-in site-defaults [:security :anti-forgery] false)
>>>wrap-multipart-params
>>>wrap-params))
>>> (def app
>>>   (->
>>>(routes auth-routes
>>>home-routes
>>>upload-routes
>>>search-routes
>>>download-routes
>>>app-routes)
>>>session/wrap-noir-session
>>>(wrap-defaults(assoc-in site-defaults [:security :anti-forgery] false)
>>>wrap-multipart-params))
>>> (def app
>>>   (->
>>>(routes auth-routes
>>>home-routes
>>>upload-routes
>>>search-routes
>>>download-routes
>>>app-routes)
>>>session/wrap-noir-session
>>>(wrap-defaults (-> site-defaults
>>>   (assoc-in [:security :anti-forgery] false)
>>>   (assoc-in [:params :multipart] true)
>>>   (ass

Re: Can't extract multipart-params from POST request in compojure

2016-07-06 Thread James Reeves
In all your examples except for possibly the last, you have the multipart
middleware added twice over to your application.

Also, are you sure it's not a problem with your client code?

One thing to try is recording your HTTP request by pointing your client at
a netcat listener (e.g. "nc -l 3000"). Or writing a handler that dumps out
the headers and the contents of the request body.

- James

On 7 July 2016 at 03:18,  wrote:

> This is the link to the question in stackoverflow:
>
> http://stackoverflow.com/questions/38226276/cant-extract-multipart-params-from-post-request-in-compojure
>
> 在 2016年7月7日星期四 UTC+8上午10:13:25,aaartu...@gmail.com写道:
>
>> When I try to extract the multipart-params from a POST request like this:
>>
>> (defroutes upload-routes
>>   (POST "/upload" {params :params} (println params))
>>
>>
>> I got {}.
>>
>> Then I tried like this:
>>
>> (defroutes upload-routes
>>   (POST "/upload" {multipart-params :multipart-params} (println 
>> multipart-params))
>>
>> I still got {}.
>>
>> I guess there are something wrong about my middleware.
>>
>> So I tried to change the handler, here are the handlers I had tried:
>>
>> (ns cloudserver.handler
>>   (:require [compojure.core :refer [defroutes routes]]
>> [compojure.route :as route]
>> [compojure.handler :as handler]
>> [cloudserver.routes.home :refer [home-routes]]
>> [noir.util.middleware :as noir-middleware]
>> [cloudserver.routes.auth :refer [auth-routes]]
>> [cloudserver.routes.upload :refer [upload-routes]]
>> [cloudserver.routes.search :refer [search-routes]]
>> [cloudserver.routes.download :refer [download-routes]]
>> [ring.middleware.defaults :refer [api-defaults wrap-defaults 
>> site-defaults]]
>> [ring.middleware.multipart-params :refer [wrap-multipart-params]]
>> [ring.middleware.params :refer [wrap-params]]
>> [noir.session :as session]
>> [ring.middleware.session.memory :refer [memory-store]]))
>>
>> (def app
>>   (->
>>(routes auth-routes
>>home-routes
>>upload-routes
>>search-routes
>>download-routes
>>app-routes)
>>session/wrap-noir-session
>>(wrap-defaults(assoc-in site-defaults [:security :anti-forgery] false)
>>wrap-multipart-params
>>wrap-params))
>> (def app
>>   (->
>>(routes auth-routes
>>home-routes
>>upload-routes
>>search-routes
>>download-routes
>>app-routes)
>>session/wrap-noir-session
>>(wrap-defaults(assoc-in site-defaults [:security :anti-forgery] false)
>>wrap-multipart-params))
>> (def app
>>   (->
>>(routes auth-routes
>>home-routes
>>upload-routes
>>search-routes
>>download-routes
>>app-routes)
>>session/wrap-noir-session
>>(wrap-defaults (-> site-defaults
>>   (assoc-in [:security :anti-forgery] false)
>>   (assoc-in [:params :multipart] true)
>>   (assoc-in [:params :nested] true)))
>>handler/site))
>> (def app
>>   (->
>>(routes auth-routes
>>home-routes
>>upload-routes
>>search-routes
>>download-routes
>>app-routes)
>>wrap-multipart-params
>>session/wrap-noir-session
>>(wrap-defaults(assoc-in site-defaults [:security :anti-forgery] false)))
>> (def app
>>   (noir-middleware/app-handler
>>[auth-routes
>> home-routes
>> upload-routes
>> search-routes
>> download-routes
>> app-routes]
>>:ring-defaults (assoc site-defaults :security nil)))
>>
>> But the only result I got is {}
>> --
>>
>> My client code is:
>>
>> public int upload (String filename, String[] tags, String time, String 
>> fingerprint) throws IOException {
>> String url = host + "/upload";
>> CloseableHttpClient httpClient = 
>> HttpClients.custom().setDefaultCookieStore(cookieStore).build();
>> HttpPost httpPost =  new HttpPost(url);
>>
>> MultipartEntityBuilder mulentity = MultipartEntityBuilder.create();
>>
>> mulentity.addBin

Re: Can't extract multipart-params from POST request in compojure

2016-07-06 Thread aaarturozhao
This is the link to the question in stackoverflow:
http://stackoverflow.com/questions/38226276/cant-extract-multipart-params-from-post-request-in-compojure

在 2016年7月7日星期四 UTC+8上午10:13:25,aaartu...@gmail.com写道:
>
> When I try to extract the multipart-params from a POST request like this:
>
> (defroutes upload-routes
>   (POST "/upload" {params :params} (println params))
>
>
> I got {}.
>
> Then I tried like this:
>
> (defroutes upload-routes
>   (POST "/upload" {multipart-params :multipart-params} (println 
> multipart-params))
>
> I still got {}.
>
> I guess there are something wrong about my middleware.
>
> So I tried to change the handler, here are the handlers I had tried:
>
> (ns cloudserver.handler
>   (:require [compojure.core :refer [defroutes routes]]
> [compojure.route :as route]
> [compojure.handler :as handler]
> [cloudserver.routes.home :refer [home-routes]]
> [noir.util.middleware :as noir-middleware]
> [cloudserver.routes.auth :refer [auth-routes]]
> [cloudserver.routes.upload :refer [upload-routes]]
> [cloudserver.routes.search :refer [search-routes]]
> [cloudserver.routes.download :refer [download-routes]]
> [ring.middleware.defaults :refer [api-defaults wrap-defaults 
> site-defaults]]
> [ring.middleware.multipart-params :refer [wrap-multipart-params]]
> [ring.middleware.params :refer [wrap-params]]
> [noir.session :as session]
> [ring.middleware.session.memory :refer [memory-store]]))
>
> (def app
>   (->
>(routes auth-routes
>home-routes
>upload-routes
>search-routes
>download-routes
>app-routes)
>session/wrap-noir-session
>(wrap-defaults(assoc-in site-defaults [:security :anti-forgery] false)
>wrap-multipart-params
>wrap-params))
> (def app
>   (->
>(routes auth-routes
>home-routes
>upload-routes
>search-routes
>download-routes
>app-routes)
>session/wrap-noir-session
>(wrap-defaults(assoc-in site-defaults [:security :anti-forgery] false)
>wrap-multipart-params))
> (def app
>   (->
>(routes auth-routes
>home-routes
>upload-routes
>search-routes
>download-routes
>app-routes)
>session/wrap-noir-session
>(wrap-defaults (-> site-defaults
>   (assoc-in [:security :anti-forgery] false)
>   (assoc-in [:params :multipart] true)
>   (assoc-in [:params :nested] true)))
>handler/site))
> (def app
>   (->
>(routes auth-routes
>home-routes
>upload-routes
>search-routes
>download-routes
>app-routes)
>wrap-multipart-params
>session/wrap-noir-session
>(wrap-defaults(assoc-in site-defaults [:security :anti-forgery] false)))
> (def app
>   (noir-middleware/app-handler
>[auth-routes
> home-routes
> upload-routes
> search-routes
> download-routes
> app-routes]
>:ring-defaults (assoc site-defaults :security nil)))
>
> But the only result I got is {}
> --
>
> My client code is:
>
> public int upload (String filename, String[] tags, String time, String 
> fingerprint) throws IOException {
> String url = host + "/upload";
> CloseableHttpClient httpClient = 
> HttpClients.custom().setDefaultCookieStore(cookieStore).build(); 
> HttpPost httpPost =  new HttpPost(url);
>
> MultipartEntityBuilder mulentity = MultipartEntityBuilder.create();
>
> mulentity.addBinaryBody("photo", new File(filename));
>
> for (int i = 0; i < tags.length; i ++) {
> mulentity.addTextBody("tag" + i, tags[i]);
> }
>
> mulentity.addTextBody("fingerprint", fingerprint);
> mulentity.addTextBody("time", time);
> mulentity.addTextBody("filename", 
> filename.substring(filename.lastIndexOf(File.separatorChar) + 1, 
> filename.length()));
>
> HttpEntity entity = mulentity.build();
> httpPost.setEntity(entity);
> httpPost.setHeader("Content-Type", "multipart/form-data;boundary=" + 
> BOUNDARY);
>
> int status = 3;
>
> try {
> ResponseHandler responseHandler = new BasicResponseHandler();
> String response = httpClient.execute(httpPost, responseHandler);
> status = Integer.parseInt(

Can't extract multipart-params from POST request in compojure

2016-07-06 Thread aaarturozhao
When I try to extract the multipart-params from a POST request like this:

(defroutes upload-routes
  (POST "/upload" {params :params} (println params))


I got {}.

Then I tried like this:

(defroutes upload-routes
  (POST "/upload" {multipart-params :multipart-params} (println 
multipart-params))

I still got {}.

I guess there are something wrong about my middleware.

So I tried to change the handler, here are the handlers I had tried:

(ns cloudserver.handler
  (:require [compojure.core :refer [defroutes routes]]
[compojure.route :as route]
[compojure.handler :as handler]
[cloudserver.routes.home :refer [home-routes]]
[noir.util.middleware :as noir-middleware]
[cloudserver.routes.auth :refer [auth-routes]]
[cloudserver.routes.upload :refer [upload-routes]]
[cloudserver.routes.search :refer [search-routes]]
[cloudserver.routes.download :refer [download-routes]]
[ring.middleware.defaults :refer [api-defaults wrap-defaults 
site-defaults]]
[ring.middleware.multipart-params :refer [wrap-multipart-params]]
[ring.middleware.params :refer [wrap-params]]
[noir.session :as session]
[ring.middleware.session.memory :refer [memory-store]]))

(def app
  (->
   (routes auth-routes
   home-routes
   upload-routes
   search-routes
   download-routes
   app-routes)
   session/wrap-noir-session
   (wrap-defaults(assoc-in site-defaults [:security :anti-forgery] false)
   wrap-multipart-params
   wrap-params))
(def app
  (->
   (routes auth-routes
   home-routes
   upload-routes
   search-routes
   download-routes
   app-routes)
   session/wrap-noir-session
   (wrap-defaults(assoc-in site-defaults [:security :anti-forgery] false)
   wrap-multipart-params))
(def app
  (->
   (routes auth-routes
   home-routes
   upload-routes
   search-routes
   download-routes
   app-routes)
   session/wrap-noir-session
   (wrap-defaults (-> site-defaults
  (assoc-in [:security :anti-forgery] false)
  (assoc-in [:params :multipart] true)
  (assoc-in [:params :nested] true)))
   handler/site))
(def app
  (->
   (routes auth-routes
   home-routes
   upload-routes
   search-routes
   download-routes
   app-routes)
   wrap-multipart-params
   session/wrap-noir-session
   (wrap-defaults(assoc-in site-defaults [:security :anti-forgery] false)))
(def app
  (noir-middleware/app-handler
   [auth-routes
home-routes
upload-routes
search-routes
download-routes
app-routes]
   :ring-defaults (assoc site-defaults :security nil)))

But the only result I got is {}
--

My client code is:

public int upload (String filename, String[] tags, String time, String 
fingerprint) throws IOException {
String url = host + "/upload";
CloseableHttpClient httpClient = 
HttpClients.custom().setDefaultCookieStore(cookieStore).build(); 
HttpPost httpPost =  new HttpPost(url);

MultipartEntityBuilder mulentity = MultipartEntityBuilder.create();

mulentity.addBinaryBody("photo", new File(filename));

for (int i = 0; i < tags.length; i ++) {
mulentity.addTextBody("tag" + i, tags[i]);
}

mulentity.addTextBody("fingerprint", fingerprint);
mulentity.addTextBody("time", time);
mulentity.addTextBody("filename", 
filename.substring(filename.lastIndexOf(File.separatorChar) + 1, 
filename.length()));

HttpEntity entity = mulentity.build();
httpPost.setEntity(entity);
httpPost.setHeader("Content-Type", "multipart/form-data;boundary=" + 
BOUNDARY);

int status = 3;

try {
ResponseHandler responseHandler = new BasicResponseHandler();
String response = httpClient.execute(httpPost, responseHandler);
status = Integer.parseInt(response);
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} finally {
httpClient.close();
}
return status;
}

--

I am really a green hand in clojure web programming. Thanks a lot!

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more opti

Re: Compojure does not augment response map

2016-02-24 Thread Torsten Uhlmann
Got it, makes sense.

Thanks, Gary!

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Compojure does not augment response map

2016-02-24 Thread Gary Verhaegen
My understanding is that compojure concerns itself mostly with routing and
does not try (anymore?) to handle response maps.

Concerning ring.util.response, I think these functions are meant to be
threaded:

(-> (not-found "oh noes")
(content-type "text"))

On Wednesday, 24 February 2016, Torsten Uhlmann 
wrote:

> Thanks Gary!
>
> I haven't touched the middleware stack for a while, and I only found out
> about this thing when testing my routes for security.
> But, if response maps are supposed to be left alone, how is
> ring.util.response supposed to work, for instance the "not-found" function:
>
> (defn not-found
>   "Returns a 404 'not found' response."
>   {:added "1.1"}
>   [body]
>   {:status  404
>:headers {}
>:bodybody})
>
>
> They all return an empty header.
> I guess it's not something (not accepting the response if content type is
> missing?) that has changed in Chrome or Firefox over the last few month?
>
> But then, the compojure wiki's example for a map also manually adds the
> content-type:
> https://github.com/weavejester/compojure/wiki/Routes-In-Detail
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> 
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> 
> 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 clojure+unsubscr...@googlegroups.com
> .
> For more options, visit 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 clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Compojure does not augment response map

2016-02-24 Thread Torsten Uhlmann
Thanks Gary!

I haven't touched the middleware stack for a while, and I only found out 
about this thing when testing my routes for security.
But, if response maps are supposed to be left alone, how is 
ring.util.response supposed to work, for instance the "not-found" function:

(defn not-found
  "Returns a 404 'not found' response."
  {:added "1.1"}
  [body]
  {:status  404
   :headers {}
   :bodybody})


They all return an empty header.
I guess it's not something (not accepting the response if content type is 
missing?) that has changed in Chrome or Firefox over the last few month?

But then, the compojure wiki's example for a map also manually adds the 
content-type: https://github.com/weavejester/compojure/wiki/Routes-In-Detail

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Compojure does not augment response map

2016-02-24 Thread Gary Verhaegen
IIRC this has always been the behaviour of compojure: if you return a
string it wraps it into a minimalist, valid Ring map, but if you return a
map it assumes it is a Ring map and leaves it alone.

There is a content-type ring middleware somewhere on the web, though in
general I don't think the content type is something that can be magically
detected.

Any changes in your middlewares? The JSON middlewares in particular tend to
fill in the content type automatically (given a map for the body).


On Wednesday, 24 February 2016, Torsten Uhlmann 
wrote:

> Hi,
>
> I'm experiencing a strange behavior in my app. I'm not sure if that's
> because of a version update or something I broke...
>
> The Compojure version used is 1.4.0
>
> In the past a response like this would usually work:
>
> {:status 404
>  :headers {}
>  :body "Not authorized"}
>
>
> The map would be augmented with missing header information.
>
>
> Now the browser tells me this is an invalid response. Logging the output 
> shows that the map is returned as is, without any additional headers. Adding 
> "Content-Type" "text/html; charset=utf-8" to the :headers manually would 
> solve the problem.
>
>
> When my handler only returns a string, that is turned into a response map:
>
>
> {:status 200,
>  :headers {"Content-Type" "text/html; charset=utf-8"},
>  :body "hiha"}
>
>
> I'm using compojure's "route" function not the "defroutes" macro to assemble 
> route
>
>
> This is the development version middleware stack I'm using:
>
>
> (-> handler
> (wrap-authorization auth-backend)
> (wrap-authentication auth-backend)
> ;(wrap-spy "SPY")
> ext-session/wrap-extended-session
> (wrap-defaults ring-defaults-config)
> auth/wrap-authorized-redirects
> wrap-exceptions
> reload/wrap-reload
> wrap-enlive-reload)
>
>
> I know I could solve this by adding the content type by hand, but I'd like to 
> get to the cause of this. I'd also like to just use response functions 
> provided by ring.util.response, these do also not work currently.
>
>
> I guess I just have misconfigured something- although I have no idea what.
>
>
> Torsten.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> 
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> 
> 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 clojure+unsubscr...@googlegroups.com
> .
> For more options, visit 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 clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Compojure does not augment response map

2016-02-24 Thread Torsten Uhlmann
Hi,

I'm experiencing a strange behavior in my app. I'm not sure if that's 
because of a version update or something I broke...

The Compojure version used is 1.4.0

In the past a response like this would usually work:

{:status 404
 :headers {}
 :body "Not authorized"}


The map would be augmented with missing header information.


Now the browser tells me this is an invalid response. Logging the output shows 
that the map is returned as is, without any additional headers. Adding 
"Content-Type" "text/html; charset=utf-8" to the :headers manually would solve 
the problem.


When my handler only returns a string, that is turned into a response map:


{:status 200,
 :headers {"Content-Type" "text/html; charset=utf-8"},
 :body "hiha"}


I'm using compojure's "route" function not the "defroutes" macro to assemble 
route


This is the development version middleware stack I'm using:


(-> handler
(wrap-authorization auth-backend)
(wrap-authentication auth-backend)
;(wrap-spy "SPY")
ext-session/wrap-extended-session
(wrap-defaults ring-defaults-config)
auth/wrap-authorized-redirects
wrap-exceptions
reload/wrap-reload
wrap-enlive-reload)


I know I could solve this by adding the content type by hand, but I'd like to 
get to the cause of this. I'd also like to just use response functions provided 
by ring.util.response, these do also not work currently.


I guess I just have misconfigured something- although I have no idea what.


Torsten.


-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ANN] Compojure-api 1.0.0

2016-02-17 Thread Mikhail Malchevskiy
Started using the library recently and it already helped me a lot. So thank 
you, it is great!

четверг, 18 февраля 2016 г., 1:24:50 UTC+3 пользователь Tommi Reiman 
написал:
>
> Just after two years of the first public version, Compojure-api 1.0.0 is 
> out!
>
> Compojure-api is a web api -library on top of Compojure, adding 
> Schema-based validation, swagger-integration, bi-directional routing and 
> more.
>
> 1.0.0 contains a lot of breaking changes (for the better), covered in the 
> Changelog[1] & the Migration Guide[2]. Biggest change is that most of the 
> internal macro magic has been thrown away and simple Protocols and Records 
> are used instead. This allows much snappier development flow, sub-routes 
> can be organized better and it gives better support for external libraries 
> like the Liberator. Looks and feels now like it should have two years ago. 
> Big thanks for all the contributors and users for feedback!
>
> more info in our blog: 
> http://metosin.github.io/metosin-dev/blog/compojure-api-100/
>
> And the code: https://github.com/metosin/compojure-api
>
> cheers,
>
> Tommi
>
> [1] 
> https://github.com/metosin/compojure-api/blob/master/CHANGELOG.md#100-1722016
> [2] https://github.com/metosin/compojure-api/wiki/Migration-Guide-to-1.0.0
>
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ANN] Compojure-api 1.0.0

2016-02-17 Thread Tommi Reiman
Just after two years of the first public version, Compojure-api 1.0.0 is 
out!

Compojure-api is a web api -library on top of Compojure, adding 
Schema-based validation, swagger-integration, bi-directional routing and 
more.

1.0.0 contains a lot of breaking changes (for the better), covered in the 
Changelog[1] & the Migration Guide[2]. Biggest change is that most of the 
internal macro magic has been thrown away and simple Protocols and Records 
are used instead. This allows much snappier development flow, sub-routes 
can be organized better and it gives better support for external libraries 
like the Liberator. Looks and feels now like it should have two years ago. 
Big thanks for all the contributors and users for feedback!

more info in our blog: 
http://metosin.github.io/metosin-dev/blog/compojure-api-100/

And the code: https://github.com/metosin/compojure-api

cheers,

Tommi

[1] 
https://github.com/metosin/compojure-api/blob/master/CHANGELOG.md#100-1722016
[2] https://github.com/metosin/compojure-api/wiki/Migration-Guide-to-1.0.0


-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Chaining compojure routes

2016-02-13 Thread Alan Moore
For more info on core/context 
see: https://github.com/weavejester/compojure/wiki/Nesting-routes

Alan

On Friday, February 12, 2016 at 2:40:30 PM UTC-8, JvJ wrote:
>
> I'm just starting to use ring/compojure to create web apps.
>
> One thing I would like to do is have an updatable collection of apps that 
> can be accessed based on the URL input.
>
> For example, if I have an app named "foo", then website.com/foo would 
> redirect to that app.
>
> So far, I have the following implementation:
>
> (def route-m
>   {"foo" (routes (GET "/foo" [] "Hello Foo!"))
>"bar" (routes
>   (GET "/bar/baz" [] "Hello Foo!")
>   (GET "/bar/quux" [] "Hello Quux!"))})
>
> (def test-r
>   (routes
>(GET "/hey"
> []
> "HEY!")
>(GET "/:app*" [app]
> (route-m app
>
>
> The issue with this method is the fact that the "sub-routes" need to have 
> the full path instead of just the sub-path.  For example, "foo" needs to 
> define its routes in terms of "foo/..." instead of just "/...".
>
> Is there any way around this?
>
> Thanks.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Chaining compojure routes

2016-02-12 Thread Gregg Reynolds
On Feb 12, 2016 4:40 PM, "JvJ"  wrote:
>
> I'm just starting to use ring/compojure to create web apps.
>
> One thing I would like to do is have an updatable collection of apps that
can be accessed based on the URL input.
>
> For example, if I have an app named "foo", then website.com/foo would
redirect to that app.
>
> So far, I have the following implementation:
>
> (def route-m
>   {"foo" (routes (GET "/foo" [] "Hello Foo!"))
>"bar" (routes
>   (GET "/bar/baz" [] "Hello Foo!")
>   (GET "/bar/quux" [] "Hello Quux!"))})
>
> (def test-r
>   (routes
>(GET "/hey"
> []
> "HEY!")
>(GET "/:app*" [app]
> (route-m app
>
>
> The issue with this method is the fact that the "sub-routes" need to have
the full path instead of just the sub-path.  For example, "foo" needs to
define its routes in terms of "foo/..." instead of just "/...".
>
> Is there any way around this?
>

core/context?

> Thanks.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> 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 clojure+unsubscr...@googlegroups.com.
> For more options, visit 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 clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Chaining compojure routes

2016-02-12 Thread JvJ
I'm just starting to use ring/compojure to create web apps.

One thing I would like to do is have an updatable collection of apps that 
can be accessed based on the URL input.

For example, if I have an app named "foo", then website.com/foo would 
redirect to that app.

So far, I have the following implementation:

(def route-m
  {"foo" (routes (GET "/foo" [] "Hello Foo!"))
   "bar" (routes
  (GET "/bar/baz" [] "Hello Foo!")
  (GET "/bar/quux" [] "Hello Quux!"))})

(def test-r
  (routes
   (GET "/hey"
[]
"HEY!")
   (GET "/:app*" [app]
(route-m app


The issue with this method is the fact that the "sub-routes" need to have 
the full path instead of just the sub-path.  For example, "foo" needs to 
define its routes in terms of "foo/..." instead of just "/...".

Is there any way around this?

Thanks.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Kicking off a process in Compojure Defroutes / http-kit runserver

2016-02-01 Thread James Reeves
Why can't you just start your background threads, then start your server?

- James

On 1 February 2016 at 23:03, JvJ  wrote:

> I'm working on a web app, and I'm using defroutes to define my application
> and runserver to initialize it.  However, when run-server is called, I
> can't find a way to run code before the app starts listening for requests.
> I'd like to start a background async process that can interact with
> incoming web requests.  Is there an easy way to do this using defroutes, or
> will I have to come up with something on my own?
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> 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 clojure+unsubscr...@googlegroups.com.
> For more options, visit 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 clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Kicking off a process in Compojure Defroutes / http-kit runserver

2016-02-01 Thread Steve Ashton
This sounds like a good candidate for using Component 
(https://github.com/stuartsierra/component). I would think you could create 
a component which starts the async process. That component could then be 
provided to your ring handlers, to be used during web request processing. 


On Monday, February 1, 2016 at 6:03:57 PM UTC-5, JvJ wrote:
>
> I'm working on a web app, and I'm using defroutes to define my application 
> and runserver to initialize it.  However, when run-server is called, I 
> can't find a way to run code before the app starts listening for requests.  
> I'd like to start a background async process that can interact with 
> incoming web requests.  Is there an easy way to do this using defroutes, or 
> will I have to come up with something on my own?
>
> Thanks
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Kicking off a process in Compojure Defroutes / http-kit runserver

2016-02-01 Thread JvJ
I'm working on a web app, and I'm using defroutes to define my application 
and runserver to initialize it.  However, when run-server is called, I 
can't find a way to run code before the app starts listening for requests.  
I'd like to start a background async process that can interact with 
incoming web requests.  Is there an easy way to do this using defroutes, or 
will I have to come up with something on my own?

Thanks

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: compojure/http-kit redirection

2015-10-26 Thread James Reeves
On 26 October 2015 at 20:47, JvJ  wrote:

> I would like to have one request redirect to another page, but I'm not
> sure how:
>
> (defroutes app
>   (GET "/ws" ws-handler) ; Websocket connection
>   (GET "/user/:id" [id] ;; I want to redirect to index.html?user=id
>))
>
> When I get the /user/:id path, I would like to return index.html?user=id.
> How can that be done?
>

Return a HTTP redirect response. So for example, you could do:

  (GET "/user/:id" [id]
{:status 302
 :headers {"Location" (str "/index.html?user=" id)}
 :body nil})

For convenience, Ring has the ring.util.response/redirect function to make
this more concise:

  (GET "/user/:id" [id]
(redirect (str "/index.html?user=" id)))



> Also, how to I interpret URL params using defroutes?
>

The same way you interpret route parameters, but you'll need to add the
ring.middleware.params/wrap-params middleware to your handler.

- James

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


compojure/http-kit redirection

2015-10-26 Thread JvJ
Hi, I'm starting a web app with compojure and http-kit.  I would like to 
have one request redirect to another page, but I'm not sure how:

(defroutes app
  (GET "/ws" ws-handler) ; Websocket connection
  (GET "/user/:id" [id] ;; I want to redirect to index.html?user=id
   )
  (resources "/"))


When I get the /user/:id path, I would like to return index.html?user=id. 
 How can that be done?


Also, how to I interpret URL params using defroutes?


Thanks.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Compojure character encoding

2015-06-24 Thread James Reeves
Well, JSON should be encoded in unicode (either UTF-8, UTF-16 or UTF-32,
with UTF-8 as the default), so the clients shouldn't be having a problem if
their JSON parsers are correct.

However, you may want to try the :escape-non-ascii option that Cheshire and
Ring-JSON have. e.g.

(wrap-json-response app {:escape-non-ascii true})

This will ensure all strings in the JSON are ASCII-encoded, which may be
easier for the clients you're trying to support.

- James

On 24 June 2015 at 15:29, Jonathon McKitrick  wrote:

> Thanks, James.
>
> To clarify, Compojure has no problems serving the JSON content.  But the
> SBCL common lisp app and a third-party app (Klipfolio) both are choking on
> the output.  I was able to fix the SBCL app by telling Babel to use latin-1
> encoding, but I need another solution for the output to Klipfolio.  It's
> probably a knowledge gap on my part of correct use of encodings, and I just
> haven't found the 'correct' solution yet.
>
> On Wednesday, June 24, 2015 at 9:23:36 AM UTC-4, James Reeves wrote:
>>
>> Yes, you can return a full response map with the desired encoding:
>>
>>   (GET "/" []
>> {:status 200
>>  :headers {"Content-Type" "text/html; charset=ISO-8859-1"}
>>  :body "Hello World"})
>>
>> Or use the ring.util.response namespace:
>>
>>   (GET "/" []
>> (-> (resp/response "Hello World")
>> (resp/charset "ISO-8859-1")))
>>
>> Or write some middleware to change the charset globally:
>>
>>   (defn text-response? [response]
>> (some-> (resp/get-header response "Content-Type")
>> (.startsWith "text/")))
>>
>>   (defn wrap-charset [handler charset]
>> (fn [request]
>>   (let [response (handler request)]
>> (if (text-response? response)
>>   (resp/charset response "ISO-8859-1")
>>   response
>>
>> However, it's odd that you "can't consume UTF-8 encoding". Are you sure
>> that's the problem?
>>
>> - James
>>
>>
>> On 24 June 2015 at 14:47, Jonathon McKitrick  wrote:
>>
>>> I have a web app that apparently cannot consume UTF-8 encoding.  Can
>>> compojure generate responses in latin-1 encoding?
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clo...@googlegroups.com
>>> Note that posts from new members are moderated - please be patient with
>>> your first post.
>>> To unsubscribe from this group, send email to
>>> clojure+u...@googlegroups.com
>>> 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 clojure+u...@googlegroups.com.
>>> For more options, visit 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 clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Compojure character encoding

2015-06-24 Thread Jonathon McKitrick
Thanks, James.

To clarify, Compojure has no problems serving the JSON content.  But the 
SBCL common lisp app and a third-party app (Klipfolio) both are choking on 
the output.  I was able to fix the SBCL app by telling Babel to use latin-1 
encoding, but I need another solution for the output to Klipfolio.  It's 
probably a knowledge gap on my part of correct use of encodings, and I just 
haven't found the 'correct' solution yet.

On Wednesday, June 24, 2015 at 9:23:36 AM UTC-4, James Reeves wrote:
>
> Yes, you can return a full response map with the desired encoding:
>
>   (GET "/" []
> {:status 200
>  :headers {"Content-Type" "text/html; charset=ISO-8859-1"}
>  :body "Hello World"})
>
> Or use the ring.util.response namespace:
>
>   (GET "/" []
> (-> (resp/response "Hello World")
> (resp/charset "ISO-8859-1")))
>
> Or write some middleware to change the charset globally:
>
>   (defn text-response? [response]
> (some-> (resp/get-header response "Content-Type")
> (.startsWith "text/")))
>
>   (defn wrap-charset [handler charset]
> (fn [request]
>   (let [response (handler request)]
> (if (text-response? response)
>   (resp/charset response "ISO-8859-1")
>   response
>
> However, it's odd that you "can't consume UTF-8 encoding". Are you sure 
> that's the problem?
>
> - James
>
>
> On 24 June 2015 at 14:47, Jonathon McKitrick  > wrote:
>
>> I have a web app that apparently cannot consume UTF-8 encoding.  Can 
>> compojure generate responses in latin-1 encoding?
>>
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com 
>> 
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com 
>> 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 clojure+u...@googlegroups.com .
>> For more options, visit 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 clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Compojure character encoding

2015-06-24 Thread James Reeves
Yes, you can return a full response map with the desired encoding:

  (GET "/" []
{:status 200
 :headers {"Content-Type" "text/html; charset=ISO-8859-1"}
 :body "Hello World"})

Or use the ring.util.response namespace:

  (GET "/" []
(-> (resp/response "Hello World")
(resp/charset "ISO-8859-1")))

Or write some middleware to change the charset globally:

  (defn text-response? [response]
(some-> (resp/get-header response "Content-Type")
(.startsWith "text/")))

  (defn wrap-charset [handler charset]
(fn [request]
  (let [response (handler request)]
(if (text-response? response)
  (resp/charset response "ISO-8859-1")
  response

However, it's odd that you "can't consume UTF-8 encoding". Are you sure
that's the problem?

- James


On 24 June 2015 at 14:47, Jonathon McKitrick  wrote:

> I have a web app that apparently cannot consume UTF-8 encoding.  Can
> compojure generate responses in latin-1 encoding?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> 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 clojure+unsubscr...@googlegroups.com.
> For more options, visit 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 clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Compojure character encoding

2015-06-24 Thread Jonathon McKitrick
I have a web app that apparently cannot consume UTF-8 encoding.  Can 
compojure generate responses in latin-1 encoding?

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: using the same middleware (wrap-multipart-params) with different parameters in one app [ring] [compojure]

2015-06-10 Thread Sebastián Moreno
I know this is an old thread, but I came across the same issue today, I 
ended up with something like:

(POST "/upload" request
(multipart/wrap-multipart-params
  (fn [{{file "file"} :params}]
(handle-updload file

Sebastián

On Friday, April 4, 2014 at 2:39:23 AM UTC-3, K Livingston wrote:
>
> I'm trying to dynamically handle the InputStream in file uploads 
> (ring/compojure app via servlet/jetty).  I started with two different 
> versions of the wrap-multipart-params, one is basically a NoOp that just 
> returns the file name, and the other echoes the file back.  They both work 
> fine independently but when I try to bring them both online together, which 
> ever store is defined first is the one I see called regardless of handler.
>
> Can I only have one copy of wrap-multipart-params in the whole app?
>
> How can I change how the InputStream is handled depending on the handler?
>
> Do I need to just have the handler return the IO stream and then change 
> the behavior in each handler function?
>
> example:
> The logging store is called even with POST to /upload-echo.  The echo 
> store is never called.
>
> (defroutes file-list-routes
>   (GET "/list-content"  request (file-list/show-file-list request))
>
>   (GET "/upload-logging" request 
>(upload/simple-upload-file "upload-logging" request))
>   (mp/wrap-multipart-params 
>(POST "/upload-logging" request (upload/upload-logging-file request))
>{:store upload/logging-store})
>
>   (GET "/upload-echo" request 
>(upload/simple-upload-file "upload-echo" request))
>   (mp/wrap-multipart-params 
>(POST "/upload-echo" request (upload/upload-echo-file request))
>{:store upload/echo-store})
>
>   );end route list
>
> These routes are then nested into some other context calls and of course 
> other middleware, until eventually making it up to the servlet.  There are 
> no other calls to wrap-multipart-params in my application.
>
> Thanks for your help,
> Kevin
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ANN] Ring-swagger 0.20.0, Compojure-api 0.20.0 & other schema/web libs

2015-04-26 Thread Tommi Reiman
Hi all,

We here at Metosin have been developing some open source libs, mostly stuff 
related to web. Most of the libs have got big new releases lately, so 
though of promoting them here too. Here goes:

* *Ring-Swagger 0.20.0* (https://github.com/metosin/ring-swagger)
  - support lib for generating Swagger 1.2 & 2.0 specs out of clojure web 
apps
  - build on top of Prismatic Schema with enhanced coercion, serialization 
& middlewares
  - extracts Swagger JSON Schemas out of deeply nested Prismatic Schemas
  - external routing lib adapters using ring-swagger:
- Compojure-api
- Fnhouse-swagger (https://github.com/metosin/fnhouse-swagger)
- Pedestal-swagger (https://github.com/frankiesardo/pedestal-swagger)
  - just hit the 20k download mark, thanks for all the contributors!

* *Compojure-api 0.20.0* (https://github.com/metosin/compojure-api)
  - started out as a macro learning experiment, but turned into a 
feature-rich api lib on top of Compojure
  - schema-based validation, doc-generation & extension points for adding 
your own stuff in
  - latest version now with naked Swagger 2.0 support, all known bugs fixed

* *Ring-http-response 0.6.1* (https://github.com/metosin/ring-http-response)
  - complete set of http response functions and predicates, now partially 
also for ClojureScript

* *Schema-tools 0.4.0* (https://github.com/metosin/schema-tools)
  - helpers for manipulating the Prismatic Schemas (schema-aware 
map-operations, walkers etc.)

* *scjsv 0.2.0* (https://github.com/metosin/scjsv)
  - Simple Clojure JSON Schema Validator, tiny wrapper for 
https://github.com/fge/json-schema-validator

* *Ring-swagger-ui* 2.1.1-M2
  - just a jar-packaged and preconfigured (for ring-swagger) latest version 
of the Swagger-UI
  - all props to Reverb technologies for the awesomeness

We are currently developing a macro-free Swagger-enabled CQRS lib and for 
that, abstracting & extracting stuff from our real projects & compojure-api 
back to ring-swagger & to maybe to new web-related schema-libs. Trying to 
go with the "one library does one thing good" -approach with small and 
extendable libraries. One target is to clean up a pluggable symmetric 
serialization & coercion for all common data types with out-of-the-box 
coverage the common wire-formats (json, edn, transit, (s/maybe xml)). 
Contributions welcome and we are happy to help others to adapt the stuff we 
have been doing, so feel free to ping us - firstname @metosin.fi or 
ikitommi / Deraen at freenode.

Tommi & Juho

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Part 6 of building a Compojure address book: Deployment

2015-01-17 Thread Jarrod Taylor
The last installment in a blog series covering developing and testing a 
Compojure web app. This wraps it up by address deployment. 

http://www.jarrodctaylor.com/posts/Compojure-Address-Book-Part-6/

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: equivalent of Compojure resources in juxt/bidi

2015-01-12 Thread clifford
It works, thanks Malcom.

It is surprisingly easy once you understand how to wire it together.

Thanks for your help and a great library.

Clifford

On Sunday, 11 January 2015 21:27:06 UTC+2, cliff wrote:
>
> Hi 
>
> I am trying to mimic the following Compojure behaviour, in juxt/bidi
>
> (defroutes routes
>>   (*resources* "/")
>>   (GET "/*" req (io/resource "index.html")))
>>
>  
>
>> (def http-handler (reload/wrap-reload (api #'routes)))
>
>
> In Compojure, the 'resources' function seems to load all resources by 
> default from /resources/public/.
> When I try set up the equivalent routes in bidi, I keep getting errors of 
> resources not found.
>
> How would you do this in, juxt/bidi ?
>
> Thanks
> Clifford
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: equivalent of Compojure resources in juxt/bidi

2015-01-12 Thread Malcolm Sparks
Hi Clifford,

First, br/resource-maybe can only appear as the second item of a route 
pair, because it only satisfies the bidi.bidi/Matched protocol. The first 
item of a route pair is for patterns only, i.e. types that satisfy 
bidi.bidi/Pattern protocol.

What you are trying to do is easy (when you know how).

Let's assume you have a file in your project resources/public/foo.txt such 
that

(io/resource "public/foo.txt") 

returns non-nil

Your route structure could look like this :-

(def routes
  ["" [
   ["/index.html" :index]
   ["" (br/resources {:prefix "public"})]
   ]])

Note here I'm using a *vector-of-vectors* syntax, which I recommend when 
you have ambiguous patterns because the order in which the patterns should 
be tried is made explicit. (You can use maps, but I suggest using the more 
verbose vector-of-vectors syntax in cases such as this)

(bidi/match-route routes "/index.html") => {:handler :index} 

as we should expect.

(bidi/match-route routes "/foo.txt")

will try fail the "/index.html" pattern, and try the "" pattern with a 
remainder of "/foo.txt". The prefix of "public" is then preprending, 
resulting in the string "public/foo.txt", which is passed to io/resource - 
and we get a hit.

The difference between resources and resources-maybe, is that resources 
will always return a handler - if the resource doesn't exist the handler 
will return {:status 404} - no other patterns will be tried. If you use 
resources-maybe, then a nil is returned if there is no matching resource, 
and any remaining patterns are then tried.

I hope this helps - let me know if you need more help.

Regards,

Malcolm

On Monday, 12 January 2015 07:27:16 UTC, cliff wrote:
>
> Would something like this be correct?
>
> (def routes
>>   ["" {
>>"/" {["" (br/resources-maybe {:prefix "public"})] 
>> :home-page-handler}}])
>
>
> On Monday, 12 January 2015 08:39:19 UTC+2, cliff wrote:
>>
>> Hi Dan
>>
>> Thanks for that. I have read that section. 
>> My question is, how do I associate the "/" route with both a handler and 
>> the 'resources-maybe'?
>>
>> I would like the resources to pick up the Google Closure library sitting 
>> in 'resources/public/js/out' when navigating to '/index.html'
>>
>>
>>
>> On Monday, 12 January 2015 00:36:59 UTC+2, Dan Kersten wrote:
>>>
>>> Hi,
>>>
>>> Take a look at https://github.com/juxt/bidi#resources-and-resourcesmaybe
>>>
>>> Regards,
>>> Dan
>>>
>>> On 11 January 2015 at 19:27, cliff  wrote:
>>>
>>>> Hi 
>>>>
>>>> I am trying to mimic the following Compojure behaviour, in juxt/bidi
>>>>
>>>> (defroutes routes
>>>>>   (*resources* "/")
>>>>>   (GET "/*" req (io/resource "index.html")))
>>>>>
>>>>  
>>>>
>>>>> (def http-handler (reload/wrap-reload (api #'routes)))
>>>>
>>>>
>>>> In Compojure, the 'resources' function seems to load all resources by 
>>>> default from /resources/public/.
>>>> When I try set up the equivalent routes in bidi, I keep getting errors 
>>>> of resources not found.
>>>>
>>>> How would you do this in, juxt/bidi ?
>>>>
>>>> Thanks
>>>> Clifford
>>>>
>>>> -- 
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Clojure" group.
>>>> To post to this group, send email to clo...@googlegroups.com
>>>> Note that posts from new members are moderated - please be patient with 
>>>> your first post.
>>>> To unsubscribe from this group, send email to
>>>> clojure+u...@googlegroups.com
>>>> 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 clojure+u...@googlegroups.com.
>>>> For more options, visit 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 clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: equivalent of Compojure resources in juxt/bidi

2015-01-11 Thread cliff
Would something like this be correct?

(def routes
>   ["" {
>"/" {["" (br/resources-maybe {:prefix "public"})] 
> :home-page-handler}}])


On Monday, 12 January 2015 08:39:19 UTC+2, cliff wrote:
>
> Hi Dan
>
> Thanks for that. I have read that section. 
> My question is, how do I associate the "/" route with both a handler and 
> the 'resources-maybe'?
>
> I would like the resources to pick up the Google Closure library sitting 
> in 'resources/public/js/out' when navigating to '/index.html'
>
>
>
> On Monday, 12 January 2015 00:36:59 UTC+2, Dan Kersten wrote:
>>
>> Hi,
>>
>> Take a look at https://github.com/juxt/bidi#resources-and-resourcesmaybe
>>
>> Regards,
>> Dan
>>
>> On 11 January 2015 at 19:27, cliff  wrote:
>>
>>> Hi 
>>>
>>> I am trying to mimic the following Compojure behaviour, in juxt/bidi
>>>
>>> (defroutes routes
>>>>   (*resources* "/")
>>>>   (GET "/*" req (io/resource "index.html")))
>>>>
>>>  
>>>
>>>> (def http-handler (reload/wrap-reload (api #'routes)))
>>>
>>>
>>> In Compojure, the 'resources' function seems to load all resources by 
>>> default from /resources/public/.
>>> When I try set up the equivalent routes in bidi, I keep getting errors 
>>> of resources not found.
>>>
>>> How would you do this in, juxt/bidi ?
>>>
>>> Thanks
>>> Clifford
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clo...@googlegroups.com
>>> Note that posts from new members are moderated - please be patient with 
>>> your first post.
>>> To unsubscribe from this group, send email to
>>> clojure+u...@googlegroups.com
>>> 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 clojure+u...@googlegroups.com.
>>> For more options, visit 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 clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: equivalent of Compojure resources in juxt/bidi

2015-01-11 Thread cliff
Hi Dan

Thanks for that. I have read that section. 
My question is, how do I associate the "/" route with both a handler and 
the 'resources-maybe'?

I would like the resources to pick up the Google Closure library sitting in 
'resources/public/js/out' when navigating to '/index.html'



On Monday, 12 January 2015 00:36:59 UTC+2, Dan Kersten wrote:
>
> Hi,
>
> Take a look at https://github.com/juxt/bidi#resources-and-resourcesmaybe
>
> Regards,
> Dan
>
> On 11 January 2015 at 19:27, cliff > 
> wrote:
>
>> Hi 
>>
>> I am trying to mimic the following Compojure behaviour, in juxt/bidi
>>
>> (defroutes routes
>>>   (*resources* "/")
>>>   (GET "/*" req (io/resource "index.html")))
>>>
>>  
>>
>>> (def http-handler (reload/wrap-reload (api #'routes)))
>>
>>
>> In Compojure, the 'resources' function seems to load all resources by 
>> default from /resources/public/.
>> When I try set up the equivalent routes in bidi, I keep getting errors of 
>> resources not found.
>>
>> How would you do this in, juxt/bidi ?
>>
>> Thanks
>> Clifford
>>
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com 
>> 
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com 
>> 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 clojure+u...@googlegroups.com .
>> For more options, visit 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 clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: equivalent of Compojure resources in juxt/bidi

2015-01-11 Thread Daniel Kersten
Hi,

Take a look at https://github.com/juxt/bidi#resources-and-resourcesmaybe

Regards,
Dan

On 11 January 2015 at 19:27, cliff  wrote:

> Hi
>
> I am trying to mimic the following Compojure behaviour, in juxt/bidi
>
> (defroutes routes
>>   (*resources* "/")
>>   (GET "/*" req (io/resource "index.html")))
>>
>
>
>> (def http-handler (reload/wrap-reload (api #'routes)))
>
>
> In Compojure, the 'resources' function seems to load all resources by
> default from /resources/public/.
> When I try set up the equivalent routes in bidi, I keep getting errors of
> resources not found.
>
> How would you do this in, juxt/bidi ?
>
> Thanks
> Clifford
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> 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 clojure+unsubscr...@googlegroups.com.
> For more options, visit 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 clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


equivalent of Compojure resources in juxt/bidi

2015-01-11 Thread cliff
Hi 

I am trying to mimic the following Compojure behaviour, in juxt/bidi

(defroutes routes
>   (*resources* "/")
>   (GET "/*" req (io/resource "index.html")))
>
 

> (def http-handler (reload/wrap-reload (api #'routes)))


In Compojure, the 'resources' function seems to load all resources by 
default from /resources/public/.
When I try set up the equivalent routes in bidi, I keep getting errors of 
resources not found.

How would you do this in, juxt/bidi ?

Thanks
Clifford

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Ring and Compojure with Node.js via Clojurescript

2014-12-16 Thread Matthew Molloy
Update:

Somebody else has beat me to it.  

https://github.com/bodil/dogfort

Matt

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Ring and Compojure with Node.js via Clojurescript

2014-12-13 Thread Matthew Molloy
Thanks for the feedback.  I'll let you know how things progress.

Matthew

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Ring and Compojure with Node.js via Clojurescript

2014-12-09 Thread James Reeves
On 9 December 2014 at 11:07, Thomas Heller  wrote:

> Due to significant platform differences from the JVM to Node.js (no real
> threads, everything needs callbacks) you'd probably be better off writing
> something more javascript-y. Porting Ring is probably not likely since
> everything is async and Ring is not.
>

Ring does have support for async behaviour. All the core middleware
functions are split into request and response parts, allowing them to be
applied asynchronously. It's how Pedestal uses Ring.

You'd still need to change the handler abstraction, since that's
synchronous by design, but there's a lot from Ring that could potentially
be reused.

- James

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Ring and Compojure with Node.js via Clojurescript

2014-12-09 Thread Angel Java Lopez
Another path: write ClojureScript that consumes directly Nodejs and some
popular web framework (like Express). Then, you can write the
controllers/actions/logic in ClojureScript. I'm not sure about the
feasibility of this idea from clojurescript.

Angel "Java" Lopez
@ajlopez

On Tue, Dec 9, 2014 at 8:26 AM, Angel Java Lopez 
wrote:

> Maybe when you reach the async nature of node.js, you could use node fibers
> https://github.com/laverdet/node-fibers
>
> to wrap up async calls as sync ones, as a "baby step" to implement your
> ideas.
>
> Meteor
> https://www.meteor.com/
>  use a lot of fibers internally.
>
> Angel "Java" Lopez
> @ajlopez
>
>
> On Tue, Dec 9, 2014 at 8:07 AM, Thomas Heller  wrote:
>
>> Due to significant platform differences from the JVM to Node.js (no real
>> threads, everything needs callbacks) you'd probably be better off writing
>> something more javascript-y. Porting Ring is probably not likely since
>> everything is async and Ring is not. Same goes for Compojure but that is
>> mostly macro stuff so it could probably fit in somehow.
>>
>> Running something on Node.js requires a completely different (async) way
>> of thinking, which you don't nescessarily do on the JVM. You'd probably be
>> better of using something from the node.js ecosystem. Iits not like you
>> could ever take any Clojure Ring Handler and plug it into
>> ClojureScript/Node, at least not likely as soon as you do something with IO.
>>
>> Just my 2 cents,
>> /thomas
>>
>> On Monday, December 8, 2014 3:50:48 PM UTC+1, Matthew Molloy wrote:
>>
>>> Dear Community,
>>>
>>> I love making Clojure web apps, however their startup time is a serious
>>> drawback when used with a transient hosting service such as Heroku.  My
>>> thought is to port Ring and Compojure over to Clojurescript so that can get
>>> their nice abstractions hosted on the Node.js runtime.
>>>
>>> Any thoughts or suggestions?
>>>
>>> Matthew
>>>
>>  --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> 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 clojure+unsubscr...@googlegroups.com.
>> For more options, visit 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 clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Ring and Compojure with Node.js via Clojurescript

2014-12-09 Thread Angel Java Lopez
Maybe when you reach the async nature of node.js, you could use node fibers
https://github.com/laverdet/node-fibers

to wrap up async calls as sync ones, as a "baby step" to implement your
ideas.

Meteor
https://www.meteor.com/
 use a lot of fibers internally.

Angel "Java" Lopez
@ajlopez


On Tue, Dec 9, 2014 at 8:07 AM, Thomas Heller  wrote:

> Due to significant platform differences from the JVM to Node.js (no real
> threads, everything needs callbacks) you'd probably be better off writing
> something more javascript-y. Porting Ring is probably not likely since
> everything is async and Ring is not. Same goes for Compojure but that is
> mostly macro stuff so it could probably fit in somehow.
>
> Running something on Node.js requires a completely different (async) way
> of thinking, which you don't nescessarily do on the JVM. You'd probably be
> better of using something from the node.js ecosystem. Iits not like you
> could ever take any Clojure Ring Handler and plug it into
> ClojureScript/Node, at least not likely as soon as you do something with IO.
>
> Just my 2 cents,
> /thomas
>
> On Monday, December 8, 2014 3:50:48 PM UTC+1, Matthew Molloy wrote:
>
>> Dear Community,
>>
>> I love making Clojure web apps, however their startup time is a serious
>> drawback when used with a transient hosting service such as Heroku.  My
>> thought is to port Ring and Compojure over to Clojurescript so that can get
>> their nice abstractions hosted on the Node.js runtime.
>>
>> Any thoughts or suggestions?
>>
>> Matthew
>>
>  --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> 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 clojure+unsubscr...@googlegroups.com.
> For more options, visit 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 clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Ring and Compojure with Node.js via Clojurescript

2014-12-09 Thread Thomas Heller
Due to significant platform differences from the JVM to Node.js (no real 
threads, everything needs callbacks) you'd probably be better off writing 
something more javascript-y. Porting Ring is probably not likely since 
everything is async and Ring is not. Same goes for Compojure but that is 
mostly macro stuff so it could probably fit in somehow.

Running something on Node.js requires a completely different (async) way of 
thinking, which you don't nescessarily do on the JVM. You'd probably be 
better of using something from the node.js ecosystem. Iits not like you 
could ever take any Clojure Ring Handler and plug it into 
ClojureScript/Node, at least not likely as soon as you do something with IO.

Just my 2 cents,
/thomas

On Monday, December 8, 2014 3:50:48 PM UTC+1, Matthew Molloy wrote:
>
> Dear Community,
>
> I love making Clojure web apps, however their startup time is a serious 
> drawback when used with a transient hosting service such as Heroku.  My 
> thought is to port Ring and Compojure over to Clojurescript so that can get 
> their nice abstractions hosted on the Node.js runtime.
>
> Any thoughts or suggestions?
>
> Matthew
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Ring and Compojure with Node.js via Clojurescript

2014-12-08 Thread Henrik Eneroth
Awesome! I look forward to seeing the results.

On Monday, December 8, 2014 3:50:48 PM UTC+1, Matthew Molloy wrote:
>
> Dear Community,
>
> I love making Clojure web apps, however their startup time is a serious 
> drawback when used with a transient hosting service such as Heroku.  My 
> thought is to port Ring and Compojure over to Clojurescript so that can get 
> their nice abstractions hosted on the Node.js runtime.
>
> Any thoughts or suggestions?
>
> Matthew
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Ring and Compojure with Node.js via Clojurescript

2014-12-08 Thread Matthew Molloy
Dear Community,

I love making Clojure web apps, however their startup time is a serious 
drawback when used with a transient hosting service such as Heroku.  My 
thought is to port Ring and Compojure over to Clojurescript so that can get 
their nice abstractions hosted on the Node.js runtime.

Any thoughts or suggestions?

Matthew

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Ring and Compojure in Clojurescript

2014-12-08 Thread Matthew Molloy
Hi guys,

I love making Clojure web apps, however their startup time is a serious 
drawback when used with a transient hosting service such as Heroku.  My 
thought is to port Ring and Compojure over to Clojurescript and create a 
Node.js ring adapter.  Has anybody tried something like this?  Any 
suggestions?

Matt

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Content-negotiation in compojure web libraries/frameworks the right way (tm)

2014-11-05 Thread Nils Grunwald
You can take a look at https://github.com/ngrunwald/ring-middleware-format 
which tries to handle content negociation only in a sane and flexible way 
for REST api.

On Wednesday, November 5, 2014 2:47:02 PM UTC+1, Miguel Ping wrote:
>
> Hi all,
>
> What's the best way to do content-negotiation on compojure-based web 
> frameworks? I know liberator deals with it in a special way, I was 
> wondering if is there anything out there to deal with it like rails does.
> Right now I have a big cond:
>
> (defn handle-home [req]
>   (let [content-type (-> (clojure.walk/keywordize-keys req) :headers 
> :content-type)]
> (cond  (empty? content-type)
>(home-page) ;renders selmer
>
>(= "application/json" content-type)
>(generate-string (db/get-messages)) ;cheshire json generation
>
>:else
>{:status 415 :body "unavailable-content-type"})))
>
> But I'm pretty sure there's a more idiomatic way of defining resources. 
> I'd like a way to just return a hash, and according to content-type either 
> render an html (through selmer, whatever) or a json from that map.
> I'm sure this is pretty easy with clojure but I'm still quite new to it. 
> I'd like to see how you guys are dealing with this.
> I'm trying luminus right now but I'm guessing this is the same for any 
> compojure-based routing.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Content-negotiation in compojure web libraries/frameworks the right way (tm)

2014-11-05 Thread Herwig Hochleitner
Liberator is very helpful for this:
http://clojure-liberator.github.io/liberator/

2014-11-05 14:47 GMT+01:00 Miguel Ping :

> Hi all,
>
> What's the best way to do content-negotiation on compojure-based web
> frameworks? I know liberator deals with it in a special way, I was
> wondering if is there anything out there to deal with it like rails does.
> Right now I have a big cond:
>
> (defn handle-home [req]
>   (let [content-type (-> (clojure.walk/keywordize-keys req) :headers
> :content-type)]
> (cond  (empty? content-type)
>(home-page) ;renders selmer
>
>(= "application/json" content-type)
>(generate-string (db/get-messages)) ;cheshire json generation
>
>:else
>{:status 415 :body "unavailable-content-type"})))
>
> But I'm pretty sure there's a more idiomatic way of defining resources.
> I'd like a way to just return a hash, and according to content-type either
> render an html (through selmer, whatever) or a json from that map.
> I'm sure this is pretty easy with clojure but I'm still quite new to it.
> I'd like to see how you guys are dealing with this.
> I'm trying luminus right now but I'm guessing this is the same for any
> compojure-based routing.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> 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 clojure+unsubscr...@googlegroups.com.
> For more options, visit 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 clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Content-negotiation in compojure web libraries/frameworks the right way (tm)

2014-11-05 Thread Miguel Ping
Hi all,

What's the best way to do content-negotiation on compojure-based web 
frameworks? I know liberator deals with it in a special way, I was 
wondering if is there anything out there to deal with it like rails does.
Right now I have a big cond:

(defn handle-home [req]
  (let [content-type (-> (clojure.walk/keywordize-keys req) :headers 
:content-type)]
(cond  (empty? content-type)
   (home-page) ;renders selmer

   (= "application/json" content-type)
   (generate-string (db/get-messages)) ;cheshire json generation

   :else
   {:status 415 :body "unavailable-content-type"})))

But I'm pretty sure there's a more idiomatic way of defining resources. I'd 
like a way to just return a hash, and according to content-type either 
render an html (through selmer, whatever) or a json from that map.
I'm sure this is pretty easy with clojure but I'm still quite new to it. 
I'd like to see how you guys are dealing with this.
I'm trying luminus right now but I'm guessing this is the same for any 
compojure-based routing.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Print broken in Cider 0.7.0 - Ring - Compojure

2014-10-30 Thread Steve Shogren
Also, where would I put the bug, in nrepl, cider, or cider-nrepl?

On Wednesday, October 29, 2014 1:12:14 PM UTC-4, Bozhidar Batsov wrote:
>
> I’d suggest filing the a ticket with output from *nrepl-messages* so we 
> can have an idea what’s going on.
> You can also try the 0.8-snapshot.
>
> —
> Cheers, 
> Bozhidar
>
> On October 29, 2014 at 5:43:56 PM, Steve Shogren (steve.a...@gmail.com 
> ) wrote:
>
> Supposedly that was fixed in nrepl 0.2.6, which is the version I am using. 
> Still nothing.
>
> On Wednesday, October 29, 2014 10:15:34 AM UTC-4, Bozhidar Batsov wrote: 
>>
>>  I recall that a similar problem was caused by a buggy nREPL version. 
>>  See https://github.com/clojure-emacs/cider/issues/785
>>  
>> — 
>> Cheers, 
>> Bozhidar
>>  
>> On October 29, 2014 at 2:41:02 PM, Steve Shogren (steve.a...@gmail.com) 
>> wrote:
>>
>>  I cannot seem to see the results of "println", "print", or 
>> "clojure.tools.trace/trace" when running my site, per my setup here: 
>> http://stackoverflow.com/questions/22365741/missing-out-in-clojure-with-lein-and-ring?lq=1
>>  
>>
>> The one comment suggested trying (.println System/out msg) which prints 
>> as I would expect, but the others still do not. Any ideas how I could fix 
>> trace, print, and println?
>>
>> Thanks!
>>  --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com
>> 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 clojure+u...@googlegroups.com.
>> For more options, visit 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 clo...@googlegroups.com 
> Note that posts from new members are moderated - please be patient with 
> your first post.
> To unsubscribe from this group, send email to
> clojure+u...@googlegroups.com 
> 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 clojure+u...@googlegroups.com .
> For more options, visit 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 clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Print broken in Cider 0.7.0 - Ring - Compojure

2014-10-30 Thread Steve Shogren
Would this be the nrepl log needed? 

(dict
 ("id" . "46")
 ("session" . "de710656-5527-4bf7-9b16-c89f818ed326")
 ("status" "done"))
("id" "47" "ns" "nimbus-admin.test.integrations" "op" "eval" "session" 
"de710656-5527-4bf7-9b16-c89f818ed326" "code" "(trace \"test\")\n")
(dict
 ("id" . "4")
 ("out" . "TRACE: \"test\"\n")
 ("session" . "de710656-5527-4bf7-9b16-c89f818ed326"))


On Wednesday, October 29, 2014 1:12:14 PM UTC-4, Bozhidar Batsov wrote:
>
> I’d suggest filing the a ticket with output from *nrepl-messages* so we 
> can have an idea what’s going on.
> You can also try the 0.8-snapshot.
>
> —
> Cheers, 
> Bozhidar
>
> On October 29, 2014 at 5:43:56 PM, Steve Shogren (steve.a...@gmail.com 
> ) wrote:
>
> Supposedly that was fixed in nrepl 0.2.6, which is the version I am using. 
> Still nothing.
>
> On Wednesday, October 29, 2014 10:15:34 AM UTC-4, Bozhidar Batsov wrote: 
>>
>>  I recall that a similar problem was caused by a buggy nREPL version. 
>>  See https://github.com/clojure-emacs/cider/issues/785
>>  
>> — 
>> Cheers, 
>> Bozhidar
>>  
>> On October 29, 2014 at 2:41:02 PM, Steve Shogren (steve.a...@gmail.com) 
>> wrote:
>>
>>  I cannot seem to see the results of "println", "print", or 
>> "clojure.tools.trace/trace" when running my site, per my setup here: 
>> http://stackoverflow.com/questions/22365741/missing-out-in-clojure-with-lein-and-ring?lq=1
>>  
>>
>> The one comment suggested trying (.println System/out msg) which prints 
>> as I would expect, but the others still do not. Any ideas how I could fix 
>> trace, print, and println?
>>
>> Thanks!
>>  --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com
>> 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 clojure+u...@googlegroups.com.
>> For more options, visit 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 clo...@googlegroups.com 
> Note that posts from new members are moderated - please be patient with 
> your first post.
> To unsubscribe from this group, send email to
> clojure+u...@googlegroups.com 
> 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 clojure+u...@googlegroups.com .
> For more options, visit 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 clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Print broken in Cider 0.7.0 - Ring - Compojure

2014-10-29 Thread Bozhidar Batsov
I’d suggest filing the a ticket with output from *nrepl-messages* so we can 
have an idea what’s going on.
You can also try the 0.8-snapshot.

—
Cheers, 
Bozhidar

On October 29, 2014 at 5:43:56 PM, Steve Shogren (steve.a.shog...@gmail.com) 
wrote:

Supposedly that was fixed in nrepl 0.2.6, which is the version I am using. 
Still nothing.

On Wednesday, October 29, 2014 10:15:34 AM UTC-4, Bozhidar Batsov wrote:
I recall that a similar problem was caused by a buggy nREPL version. 
See https://github.com/clojure-emacs/cider/issues/785

—
Cheers, 
Bozhidar

On October 29, 2014 at 2:41:02 PM, Steve Shogren (steve.a...@gmail.com) wrote:

I cannot seem to see the results of "println", "print", or 
"clojure.tools.trace/trace" when running my site, per my setup here: 
http://stackoverflow.com/questions/22365741/missing-out-in-clojure-with-lein-and-ring?lq=1

The one comment suggested trying (.println
System/out msg) which prints as I would expect, but the others still do not. 
Any ideas how I could fix trace, print, and println?

Thanks!
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
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 clojure+u...@googlegroups.com.
For more options, visit 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 clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit 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 clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Print broken in Cider 0.7.0 - Ring - Compojure

2014-10-29 Thread Steve Shogren
Supposedly that was fixed in nrepl 0.2.6, which is the version I am using. 
Still nothing.

On Wednesday, October 29, 2014 10:15:34 AM UTC-4, Bozhidar Batsov wrote:
>
> I recall that a similar problem was caused by a buggy nREPL version. 
> See https://github.com/clojure-emacs/cider/issues/785
>
> —
> Cheers, 
> Bozhidar
>
> On October 29, 2014 at 2:41:02 PM, Steve Shogren (steve.a...@gmail.com 
> ) wrote:
>
> I cannot seem to see the results of "println", "print", or 
> "clojure.tools.trace/trace" when running my site, per my setup here: 
> http://stackoverflow.com/questions/22365741/missing-out-in-clojure-with-lein-and-ring?lq=1
>  
>
> The one comment suggested trying (.println System/out msg) which prints 
> as I would expect, but the others still do not. Any ideas how I could fix 
> trace, print, and println?
>
> Thanks!
>  --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com 
> Note that posts from new members are moderated - please be patient with 
> your first post.
> To unsubscribe from this group, send email to
> clojure+u...@googlegroups.com 
> 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 clojure+u...@googlegroups.com .
> For more options, visit 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 clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Print broken in Cider 0.7.0 - Ring - Compojure

2014-10-29 Thread J Irving
I had a similar problem a while back, which I caused to go away without
ever understanding what the cause was.

https://groups.google.com/forum/#!topic/cider-emacs/tMeTw79imgw

Short version, I blew away my ./target directory, and it started working
again. No idea if this helps you, but there you are.

cheers, J

On Wed, Oct 29, 2014 at 8:40 AM, Steve Shogren 
wrote:

> I cannot seem to see the results of "println", "print", or
> "clojure.tools.trace/trace" when running my site, per my setup here:
> http://stackoverflow.com/questions/22365741/missing-out-in-clojure-with-lein-and-ring?lq=1
>
> The one comment suggested trying (.println System/out msg) which prints
> as I would expect, but the others still do not. Any ideas how I could fix
> trace, print, and println?
>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> 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 clojure+unsubscr...@googlegroups.com.
> For more options, visit 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 clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Print broken in Cider 0.7.0 - Ring - Compojure

2014-10-29 Thread Bozhidar Batsov
I recall that a similar problem was caused by a buggy nREPL version. 
See https://github.com/clojure-emacs/cider/issues/785

—
Cheers, 
Bozhidar

On October 29, 2014 at 2:41:02 PM, Steve Shogren (steve.a.shog...@gmail.com) 
wrote:

I cannot seem to see the results of "println", "print", or 
"clojure.tools.trace/trace" when running my site, per my setup here: 
http://stackoverflow.com/questions/22365741/missing-out-in-clojure-with-lein-and-ring?lq=1

The one comment suggested trying (.println
System/out msg) which prints as I would expect, but the others still do not. 
Any ideas how I could fix trace, print, and println?

Thanks!
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit 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 clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Print broken in Cider 0.7.0 - Ring - Compojure

2014-10-29 Thread Steve Shogren
I cannot seem to see the results of "println", "print", or 
"clojure.tools.trace/trace" when running my site, per my setup 
here: 
http://stackoverflow.com/questions/22365741/missing-out-in-clojure-with-lein-and-ring?lq=1

The one comment suggested trying (.println System/out msg) which prints as 
I would expect, but the others still do not. Any ideas how I could fix 
trace, print, and println?

Thanks!

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ANN] Stray - An alternative routing library for Compojure

2014-10-12 Thread Kelker Ryan
Repo: https://github.com/runexec/stray StrayStray is an alternative routing library for Compojure;; Leiningen Dependency

[stray "1.01"]

(ns example
  (:require [stray.core :refer [router]]))

(def routes
  {:public {:index-page {:http/path "/"
 :http/method :GET
 :http/req :namespace.core/example-handler}
:user-page {:http/path "/user/:id"
:http/method :GET
:http/req :namespace.core/handler}}
   :dev {:new-welcome-page {:http/path "/welcome/:user"
:http/method :GET
:http/req :project.users/new-welcome}}})

(defn example-handler [req]
  (str "req: " (keys req)))

;; lein ring servers in project.clj
;; :ring {:handler namespace.core/public-app}

(def public-app (router routes :public))

(def dev-app (router routes :dev))

TutorialCreate a Projectlein new example-project
Add to project.clj:dependencies [[stray "1.01"]]
:plugins [[lein-ring "0.8.12"]]
:ring {:handler example-project.core/public-app}
Refer router in src/example_project/core.clj(ns example-project.core
  (:require [stray.core :refer [router]]))
Define routes(def routes
  {:public {:hello-page {:http/path "/hello/:name"
 :http/method :GET
 :http/req :example-project.core/hello-handler}}
   {:dev {:hello-page {:http/path "/hello/:name"
   :http/method :GET
   :http/req :example-project.core/hello-handler}}}
   {:other {:hello-page {:http/path "/hello/:name"
 :http/method :GET
 :http/req :example-project.core/hello-handler)
Define handlers(defn hello-handler [req]
  "I got a ring/compojure request!!!")

Define applications(def public-app (router routes :public))
Save and runlein ring server




-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: com.stuartsierra/component & ring/compojure example

2014-10-08 Thread Huahai Yang
This solution (creating the routes in a function and passing components 
into the function) seems to be the best solution. Other solutions all 
require defining the routes a prior, which may be the root of the problems, 
because some handlers may depend on functions generated by components in 
the run time.

-huahai


On Tuesday, October 7, 2014 10:42:14 PM UTC-7, Andrew Meredith wrote:
>
> This is not a full example, but I ran into the same issue when building an 
> app for the Clojure Cup not too long ago. The general approach I used is 
> this:
>
>- create the Compojure routes in a function with the components I need 
>as parameters
>- declare the web server itself (I used httpkit) as a component with 
>the dependencies needed for the routes
>- build a handler from the routes within the web server component's 
>start function, passing the dependencies into the route-generating function
>
> I'm no Clojure expert, and this was my first project using Stuart Sierra's 
> Component library, so I would be interested to hear some feedback from the 
> more seasoned Clojure folks here.
>
> Here is the relevant file from my project if you are interested: 
> https://github.com/kendru/tourbillon/blob/master/src/tourbillon/www/core.clj#L67
>
> On Tuesday, October 7, 2014 11:33:33 AM UTC, JPatrick Davenport wrote:
>>
>> Hello,
>> I'm trying to create a web app. I'm having the damnest time trying to 
>> figure out how to layer my application. I want to pass protocol 
>> implementations to the routes. The protocols define interacting with 
>> various data sources that I need down the way. 
>>
>> I saw Stuart Sierra's talk about Component. It looks to satisfy my needs. 
>> What I can't find is an example project for component and compojure. 
>> Unfortunately the project com.stuartsierra/component is poorly named. 
>> Googling for component + compojure brings back mostly false positives.
>>
>> Does anyone have a gist or blog post about how to do this?
>>
>> Thanks,
>> JPD
>>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: com.stuartsierra/component & ring/compojure example

2014-10-08 Thread Juho Teperi
The Stuart Sierra's talk about Component has short bit about using it with 
ring, at around 32:24 <https://www.youtube.com/watch?v=13cmHf_kt-Q#t=1944>.

Idea is that you'll wrap your basic routes with a middleware which will 
assoc components to every request.
Difference to the other approach (creating the routes using fn taking the 
components as params) is that you are referencing the routes through a var 
so you can update your routes by evaluating the route definition again and 
you don't need to reset the system.

I have a example here: https://gist.github.com/Deraen/9d65f447593859dd07ae. 
It also has some compojure-api stuff to enable easier access to components 
for the handlers.

On Tuesday, October 7, 2014 2:33:33 PM UTC+3, JPatrick Davenport wrote:
>
> Hello,
> I'm trying to create a web app. I'm having the damnest time trying to 
> figure out how to layer my application. I want to pass protocol 
> implementations to the routes. The protocols define interacting with 
> various data sources that I need down the way. 
>
> I saw Stuart Sierra's talk about Component. It looks to satisfy my needs. 
> What I can't find is an example project for component and compojure. 
> Unfortunately the project com.stuartsierra/component is poorly named. 
> Googling for component + compojure brings back mostly false positives.
>
> Does anyone have a gist or blog post about how to do this?
>
> Thanks,
> JPD
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: com.stuartsierra/component & ring/compojure example

2014-10-08 Thread Daniel Szmulewicz
I posted a working example in the system repo: 

https://github.com/danielsz/system/tree/master/example

On Tuesday, October 7, 2014 2:33:33 PM UTC+3, JPatrick Davenport wrote:
>
> Hello,
> I'm trying to create a web app. I'm having the damnest time trying to 
> figure out how to layer my application. I want to pass protocol 
> implementations to the routes. The protocols define interacting with 
> various data sources that I need down the way. 
>
> I saw Stuart Sierra's talk about Component. It looks to satisfy my needs. 
> What I can't find is an example project for component and compojure. 
> Unfortunately the project com.stuartsierra/component is poorly named. 
> Googling for component + compojure brings back mostly false positives.
>
> Does anyone have a gist or blog post about how to do this?
>
> Thanks,
> JPD
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: com.stuartsierra/component & ring/compojure example

2014-10-08 Thread Daniel Szmulewicz
1, Extract the app out of the Webserver record into its own var. 
2, Add to the Webserver record an additional argument called handler. 
2, Put the component in a separate namespace. 
3, Initialize your component with the app var. 

OR, use system, which does all of the above for you. 
https://github.com/danielsz/system/ 
<https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fdanielsz%2Fsystem%2F&sa=D&sntz=1&usg=AFQjCNGlALFOedRvbCU_dSsOE0I8pazDhQ>

I'll post an example application in the repo if people are interested.  

On Wednesday, October 8, 2014 8:42:14 AM UTC+3, Andrew Meredith wrote:
>
> This is not a full example, but I ran into the same issue when building an 
> app for the Clojure Cup not too long ago. The general approach I used is 
> this:
>
>- create the Compojure routes in a function with the components I need 
>as parameters
>- declare the web server itself (I used httpkit) as a component with 
>the dependencies needed for the routes
>- build a handler from the routes within the web server component's 
>start function, passing the dependencies into the route-generating function
>
> I'm no Clojure expert, and this was my first project using Stuart Sierra's 
> Component library, so I would be interested to hear some feedback from the 
> more seasoned Clojure folks here.
>
> Here is the relevant file from my project if you are interested: 
> https://github.com/kendru/tourbillon/blob/master/src/tourbillon/www/core.clj#L67
>
> On Tuesday, October 7, 2014 11:33:33 AM UTC, JPatrick Davenport wrote:
>>
>> Hello,
>> I'm trying to create a web app. I'm having the damnest time trying to 
>> figure out how to layer my application. I want to pass protocol 
>> implementations to the routes. The protocols define interacting with 
>> various data sources that I need down the way. 
>>
>> I saw Stuart Sierra's talk about Component. It looks to satisfy my needs. 
>> What I can't find is an example project for component and compojure. 
>> Unfortunately the project com.stuartsierra/component is poorly named. 
>> Googling for component + compojure brings back mostly false positives.
>>
>> Does anyone have a gist or blog post about how to do this?
>>
>> Thanks,
>> JPD
>>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: com.stuartsierra/component & ring/compojure example

2014-10-07 Thread Andrew Meredith
This is not a full example, but I ran into the same issue when building an 
app for the Clojure Cup not too long ago. The general approach I used is 
this:

   - create the Compojure routes in a function with the components I need 
   as parameters
   - declare the web server itself (I used httpkit) as a component with the 
   dependencies needed for the routes
   - build a handler from the routes within the web server component's 
   start function, passing the dependencies into the route-generating function

I'm no Clojure expert, and this was my first project using Stuart Sierra's 
Component library, so I would be interested to hear some feedback from the 
more seasoned Clojure folks here.

Here is the relevant file from my project if you are interested: 
https://github.com/kendru/tourbillon/blob/master/src/tourbillon/www/core.clj#L67

On Tuesday, October 7, 2014 11:33:33 AM UTC, JPatrick Davenport wrote:
>
> Hello,
> I'm trying to create a web app. I'm having the damnest time trying to 
> figure out how to layer my application. I want to pass protocol 
> implementations to the routes. The protocols define interacting with 
> various data sources that I need down the way. 
>
> I saw Stuart Sierra's talk about Component. It looks to satisfy my needs. 
> What I can't find is an example project for component and compojure. 
> Unfortunately the project com.stuartsierra/component is poorly named. 
> Googling for component + compojure brings back mostly false positives.
>
> Does anyone have a gist or blog post about how to do this?
>
> Thanks,
> JPD
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: com.stuartsierra/component & ring/compojure example

2014-10-07 Thread Daniel Szmulewicz
You may want to look here for integrating components in your app. 

https://github.com/danielsz/system/


On Tuesday, October 7, 2014 2:33:33 PM UTC+3, JPatrick Davenport wrote:
>
> Hello,
> I'm trying to create a web app. I'm having the damnest time trying to 
> figure out how to layer my application. I want to pass protocol 
> implementations to the routes. The protocols define interacting with 
> various data sources that I need down the way. 
>
> I saw Stuart Sierra's talk about Component. It looks to satisfy my needs. 
> What I can't find is an example project for component and compojure. 
> Unfortunately the project com.stuartsierra/component is poorly named. 
> Googling for component + compojure brings back mostly false positives.
>
> Does anyone have a gist or blog post about how to do this?
>
> Thanks,
> JPD
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: com.stuartsierra/component & ring/compojure example

2014-10-07 Thread gaz jones
Here is a toy app that downloads nzbs from usenet:

https://github.com/gar3thjon3s/leacher

It's not documented, but it works. The component stuff is hooked up here:

https://github.com/gar3thjon3s/leacher/blob/master/src/clj/leacher/main.clj#L53



On 7 October 2014 12:33, JPatrick Davenport  wrote:

> Hello,
> I'm trying to create a web app. I'm having the damnest time trying to
> figure out how to layer my application. I want to pass protocol
> implementations to the routes. The protocols define interacting with
> various data sources that I need down the way.
>
> I saw Stuart Sierra's talk about Component. It looks to satisfy my needs.
> What I can't find is an example project for component and compojure.
> Unfortunately the project com.stuartsierra/component is poorly named.
> Googling for component + compojure brings back mostly false positives.
>
> Does anyone have a gist or blog post about how to do this?
>
> Thanks,
> JPD
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> 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 clojure+unsubscr...@googlegroups.com.
> For more options, visit 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 clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


com.stuartsierra/component & ring/compojure example

2014-10-07 Thread JPatrick Davenport
Hello,
I'm trying to create a web app. I'm having the damnest time trying to 
figure out how to layer my application. I want to pass protocol 
implementations to the routes. The protocols define interacting with 
various data sources that I need down the way. 

I saw Stuart Sierra's talk about Component. It looks to satisfy my needs. 
What I can't find is an example project for component and compojure. 
Unfortunately the project com.stuartsierra/component is poorly named. 
Googling for component + compojure brings back mostly false positives.

Does anyone have a gist or blog post about how to do this?

Thanks,
JPD

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ANN] Compojure 1.2.0

2014-10-01 Thread James Reeves
Compojure 1.2.0 <https://github.com/weavejester/compojure> has been
released, marking the first new minor version in quite some time. There
aren't many major changes, but the code base has been polished and
modernised, and some new functions and macros added.

The minimum Clojure version has been upped to 1.5.1, and the source has had
a significant clean-up. In particular, the old custom lexer in Clout has
been replaced with Instaparse. This paves the way for future additions to
the routing syntax that weren't possible under the old system.

Improvements have been made to how Compojure handles files and resources,
and it is now better at providing sensible defaults. For example, if you
return a resource, URL or file from a route, Compojure will now attempt to
fill in the content-type, content-length and last-modified headers.

Aside from a good amount of polish, Compojure 1.2 also includes several new
functions, aimed at improving interoperability. The *compile-route*
function is now public, allowing libraries to write their own route macros.
There is also a new *rfn* macro, allowing Compojure's binding and response
rendering to be used with different routing libraries.

Another fairly significant addition is the *wrap-routes* middleware
function, which applies middleware only *after* a route has been matched.
Up until now there was no easy way to achieve this without wrapping each
route individually. This is particularly useful for certain types of
middleware, such as those that deal with authorisation.

- James

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: core.async | compojure ... odd error ... help!!

2014-09-28 Thread Mike Fikes
Hi mond,

I've been using HTTPkit with Compojure and core.async (all fronted by Nginx 
so the entire stack is async FWIW).

To glue core.async with HTTPkit when handling inbound requests, I have a 
utility function

(defn handle-async! [handler req]
  (http-server/with-channel req channel
(take! (handler req) #(http-server/send! 
channel %

and I make use of that utility function when defining routes

(defroutes all-routes
   (GET "/covers/v1/:cover" [] (partial http/handle-async! 
fetch-cover!))
   (context "/books/v1" []
(GET "/search" [] (partial http/handle-async! 
search-handler!))
(GET "/:isbn" [] (partial http/handle-async! 
get-book-by-isbn!

The handler functions fetch-cover!, search-handler!, get-book-by-isbn!, all 
return channels (they either call go for stuff that needs to be async, or 
to-chan on collections read directly from memory.

- Mike 

On Saturday, September 27, 2014 5:01:36 AM UTC-4, mond wrote:
>
> Hi James,
>
> Er, nice tip on the routes - that was another thing that I didn't expect 
> to work but was happy when it did ;-) I will of course adapt it to your 
> recommendation.
>
> Speaking to the main point, no I don't want to put a channel on to the 
> response so that's a mistake that I see and would like to avoid. I would 
> like to understand where I have gone wrong.
>
> Maybe I need to use HTTPkit instead?
>
> Thanks
>
> Ray
>
>
>
> On Saturday, 27 September 2014 02:08:50 UTC+2, James Reeves wrote:
>>
>> Hi Ray,
>>
>> I don't entirely understand why you expected this to work. Channels 
>> aren't a valid Ring response body. The error message is essentially telling 
>> you that Compojure has no way of turning the channel object you've returned 
>> into a valid response.
>>
>> The other problem you have is that the Ring Jetty adapter doesn't have 
>> any support for asynchronous operations.
>>
>> Another small point. You're using "*" as an argument name, but this isn't 
>> really recommended. This only works by coincidence, and it may be removed 
>> in future versions. Instead use something like:
>>
>> (GET ["/:brand/:country/:resource" :resource #".*"] [brand country 
>> resource] ...)
>>
>> - James
>>
>> On 27 September 2014 00:14, mond  wrote:
>>
>>> My first core.async program ... all works outside of the web app but 
>>> barfs once I put the functions inside a web container. I hope somebody in 
>>> the group can point to my obvious mistake...
>>>
>>> The idea is that the function 'respond-within-sla' will give back a 
>>> result or a come back later message after N milliseconds. It is passed a 
>>> number of ms, three functions and the arguments for the final function ... 
>>> which is the one that should operate within the SLA.
>>>
>>> (defn respond-within-sla [expected-result-milliseconds respond-ok 
>>> respond-later data-fetcher & args]
>>>   (let [data-channel (timeout expected-result-milliseconds)]
>>> (go (if-let [data (>>   ((async/close! data-channel)
>>>(respond-ok data))
>>>   (respond-later)))
>>> (go
>>>   (>! data-channel (apply data-fetcher args)
>>>
>>> To keep the volume of code to parse to a minimum I have made a few toy 
>>> functions that demonstrate the failure...
>>>
>>> ; test funcs
>>>
>>> (defn ok [data]
>>>   (prn (str "send HTTP 200 ... got data " data)))
>>>
>>> (defn later []
>>>   (prn (str "send HTTP 202 ... request received, come back later")))
>>>
>>> (defn fetcher [arg1 arg2 arg3]
>>>   (prn (str "fetching data with args " arg1 " " arg2 " " arg3))
>>>   "response-data")
>>>
>>> (defn failer [& args]
>>>   (Thread/sleep 1000)
>>>   (str "never gets here " args))
>>>
>>> ; test funcs
>>>
>>> (defn ok [data]
>>>   (prn (str "send HTTP 200 ... got data " data)))
>>>
>>> (defn later []
>>>   (prn (str "send HTTP 202 ... request received, come back later")))
>>>
>>> (defn fetcher [arg1 arg2 arg3]
>>>   (prn (str "fetching data with args " arg1 " " arg2 " " arg3))
>>>   "response-data")
>>>
>>> (defn failer

Re: core.async | compojure ... odd error ... help!!

2014-09-28 Thread Ray McDermott
Excellent - thanks. Nice to see core.async getting the ring middleware love :)

On 28 Sep 2014 at 10:48:57, Max Penet (m...@qbits.cc) wrote:

Jet supports what you were trying to do, it accepts a channel as return value 
to send the response to the client, and in the :body of the response (no matter 
the kind of response via a channel or map) to trigger chunked responses.

see here https://github.com/mpenet/jet#ring-async

On Saturday, September 27, 2014 8:08:48 PM UTC+2, mond wrote:
Thanks for the tips. I wasn't expecting magic but otherwise your points are 
well taken

Ray

Sent from my iPhone

On 27 Sep 2014, at 16:55, James Reeves  wrote:

On 27 September 2014 10:01, mond  wrote:

Speaking to the main point, no I don't want to put a channel on to the response 
so that's a mistake that I see and would like to avoid. I would like to 
understand where I have gone wrong.

You're trying to use core.async with a library that has no understanding of 
core.async. It's important to understand that core.async isn't magic; it won't 
work with libraries that weren't designed for it.
 
Maybe I need to use HTTPkit instead?

HTTP Kit has good support for async, but uses its own lightweight protocol. 
Check out the examples on their website, and if you still want to connect a 
core.async channel up to HTTP Kit, you'll need something like:

    (async/take! async-ch (fn [msg] (httpkit/send! http-ch msg)))

This tells core.async to take values off the async channel and pass them onto 
HTTP Kit.

- James
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to a topic in the Google 
Groups "Clojure" group.
To unsubscribe from this topic, visit 
https://groups.google.com/d/topic/clojure/gOsd2Zzc1Vk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to 
clojure+unsubscr...@googlegroups.com.
For more options, visit 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 clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: core.async | compojure ... odd error ... help!!

2014-09-28 Thread Max Penet
Jet supports what you were trying to do, it accepts a channel as return 
value to send the response to the client, and in the :body of the response 
(no matter the kind of response via a channel or map) to trigger chunked 
responses.

see here https://github.com/mpenet/jet#ring-async

On Saturday, September 27, 2014 8:08:48 PM UTC+2, mond wrote:
>
> Thanks for the tips. I wasn't expecting magic but otherwise your points 
> are well taken
>
> Ray
>
> Sent from my iPhone
>
> On 27 Sep 2014, at 16:55, James Reeves  > wrote:
>
> On 27 September 2014 10:01, mond > wrote:
>
>>
>> Speaking to the main point, no I don't want to put a channel on to the 
>> response so that's a mistake that I see and would like to avoid. I would 
>> like to understand where I have gone wrong.
>>
>
> You're trying to use core.async with a library that has no understanding 
> of core.async. It's important to understand that core.async isn't magic; it 
> won't work with libraries that weren't designed for it.
>  
>
>> Maybe I need to use HTTPkit instead?
>>
>
> HTTP Kit has good support for async, but uses its own lightweight 
> protocol. Check out the examples on their website, and if you still want to 
> connect a core.async channel up to HTTP Kit, you'll need something like:
>
> (async/take! async-ch (fn [msg] (httpkit/send! http-ch msg)))
>
> This tells core.async to take values off the async channel and pass them 
> onto HTTP Kit.
>
> - James
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: core.async | compojure ... odd error ... help!!

2014-09-28 Thread Max Penet
Jet supports what you were trying to do, it accepts a channel as return 
value to send the response to the client, and in the :body of the response 
(no matter the kind of response via a channel or map) to trigger chunked 
responses.

see here https://github.com/mpenet/jet#ring-async

On Saturday, September 27, 2014 8:08:48 PM UTC+2, mond wrote:
>
> Thanks for the tips. I wasn't expecting magic but otherwise your points 
> are well taken
>
> Ray
>
> Sent from my iPhone
>
> On 27 Sep 2014, at 16:55, James Reeves  > wrote:
>
> On 27 September 2014 10:01, mond > wrote:
>
>>
>> Speaking to the main point, no I don't want to put a channel on to the 
>> response so that's a mistake that I see and would like to avoid. I would 
>> like to understand where I have gone wrong.
>>
>
> You're trying to use core.async with a library that has no understanding 
> of core.async. It's important to understand that core.async isn't magic; it 
> won't work with libraries that weren't designed for it.
>  
>
>> Maybe I need to use HTTPkit instead?
>>
>
> HTTP Kit has good support for async, but uses its own lightweight 
> protocol. Check out the examples on their website, and if you still want to 
> connect a core.async channel up to HTTP Kit, you'll need something like:
>
> (async/take! async-ch (fn [msg] (httpkit/send! http-ch msg)))
>
> This tells core.async to take values off the async channel and pass them 
> onto HTTP Kit.
>
> - James
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: core.async | compojure ... odd error ... help!!

2014-09-27 Thread Ray McDermott
Thanks for the tips. I wasn't expecting magic but otherwise your points are 
well taken

Ray

Sent from my iPhone

> On 27 Sep 2014, at 16:55, James Reeves  wrote:
> 
>> On 27 September 2014 10:01, mond  wrote:
> 
>> 
>> Speaking to the main point, no I don't want to put a channel on to the 
>> response so that's a mistake that I see and would like to avoid. I would 
>> like to understand where I have gone wrong.
> 
> You're trying to use core.async with a library that has no understanding of 
> core.async. It's important to understand that core.async isn't magic; it 
> won't work with libraries that weren't designed for it.
>  
>> Maybe I need to use HTTPkit instead?
> 
> HTTP Kit has good support for async, but uses its own lightweight protocol. 
> Check out the examples on their website, and if you still want to connect a 
> core.async channel up to HTTP Kit, you'll need something like:
> 
> (async/take! async-ch (fn [msg] (httpkit/send! http-ch msg)))
> 
> This tells core.async to take values off the async channel and pass them onto 
> HTTP Kit.
> 
> - James

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: core.async | compojure ... odd error ... help!!

2014-09-27 Thread James Reeves
On 27 September 2014 10:01, mond  wrote:

>
> Speaking to the main point, no I don't want to put a channel on to the
> response so that's a mistake that I see and would like to avoid. I would
> like to understand where I have gone wrong.
>

You're trying to use core.async with a library that has no understanding of
core.async. It's important to understand that core.async isn't magic; it
won't work with libraries that weren't designed for it.


> Maybe I need to use HTTPkit instead?
>

HTTP Kit has good support for async, but uses its own lightweight protocol.
Check out the examples on their website, and if you still want to connect a
core.async channel up to HTTP Kit, you'll need something like:

(async/take! async-ch (fn [msg] (httpkit/send! http-ch msg)))

This tells core.async to take values off the async channel and pass them
onto HTTP Kit.

- James

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: core.async | compojure ... odd error ... help!!

2014-09-27 Thread mond
Hi James,

Er, nice tip on the routes - that was another thing that I didn't expect to 
work but was happy when it did ;-) I will of course adapt it to your 
recommendation.

Speaking to the main point, no I don't want to put a channel on to the 
response so that's a mistake that I see and would like to avoid. I would 
like to understand where I have gone wrong.

Maybe I need to use HTTPkit instead?

Thanks

Ray



On Saturday, 27 September 2014 02:08:50 UTC+2, James Reeves wrote:
>
> Hi Ray,
>
> I don't entirely understand why you expected this to work. Channels aren't 
> a valid Ring response body. The error message is essentially telling you 
> that Compojure has no way of turning the channel object you've returned 
> into a valid response.
>
> The other problem you have is that the Ring Jetty adapter doesn't have any 
> support for asynchronous operations.
>
> Another small point. You're using "*" as an argument name, but this isn't 
> really recommended. This only works by coincidence, and it may be removed 
> in future versions. Instead use something like:
>
> (GET ["/:brand/:country/:resource" :resource #".*"] [brand country 
> resource] ...)
>
> - James
>
> On 27 September 2014 00:14, mond > wrote:
>
>> My first core.async program ... all works outside of the web app but 
>> barfs once I put the functions inside a web container. I hope somebody in 
>> the group can point to my obvious mistake...
>>
>> The idea is that the function 'respond-within-sla' will give back a 
>> result or a come back later message after N milliseconds. It is passed a 
>> number of ms, three functions and the arguments for the final function ... 
>> which is the one that should operate within the SLA.
>>
>> (defn respond-within-sla [expected-result-milliseconds respond-ok 
>> respond-later data-fetcher & args]
>>   (let [data-channel (timeout expected-result-milliseconds)]
>> (go (if-let [data (>   ((async/close! data-channel)
>>(respond-ok data))
>>   (respond-later)))
>> (go
>>   (>! data-channel (apply data-fetcher args)
>>
>> To keep the volume of code to parse to a minimum I have made a few toy 
>> functions that demonstrate the failure...
>>
>> ; test funcs
>>
>> (defn ok [data]
>>   (prn (str "send HTTP 200 ... got data " data)))
>>
>> (defn later []
>>   (prn (str "send HTTP 202 ... request received, come back later")))
>>
>> (defn fetcher [arg1 arg2 arg3]
>>   (prn (str "fetching data with args " arg1 " " arg2 " " arg3))
>>   "response-data")
>>
>> (defn failer [& args]
>>   (Thread/sleep 1000)
>>   (str "never gets here " args))
>>
>> ; test funcs
>>
>> (defn ok [data]
>>   (prn (str "send HTTP 200 ... got data " data)))
>>
>> (defn later []
>>   (prn (str "send HTTP 202 ... request received, come back later")))
>>
>> (defn fetcher [arg1 arg2 arg3]
>>   (prn (str "fetching data with args " arg1 " " arg2 " " arg3))
>>   "response-data")
>>
>> (defn failer [& args]
>>   (Thread/sleep 1000)
>>   (str "never gets here " args))
>>
>> (defn generate-response [brand country resource]
>>   (let [sla (or (env :sla-milliseconds) 100)]
>> (respond-within-sla sla ok later fetcher brand country resource)))
>>
>> (defn generate-fail [brand country resource]
>>   (let [sla (or (env :sla-milliseconds) 100)]
>> (respond-within-sla sla ok later failer brand country resource)))
>>
>> From within the REPL it all works fine...
>>
>> (generate-response "A" "B" "C")
>> => #> clojure.core.async.impl.channels.ManyToManyChannel@4b7ae3f7>
>> "fetching data with args A B C"
>> "send HTTP 200 ... got data response-data"
>> (generate-fail "A" "B" "C")
>> => #> clojure.core.async.impl.channels.ManyToManyChannel@4eb8b5a9>
>> "send HTTP 202 ... request received, come back later"
>>
>> Here is the compojure route..
>>
>> (defroutes app
>>(GET "/:brand/:country/*" [brand country *]
>> (generate-response brand country *))
>>
>>(ANY "*" []
>> (route/not-found "You must use a REST style to specify 
>> brand and country keys in the URL

Re: core.async | compojure ... odd error ... help!!

2014-09-26 Thread James Reeves
Hi Ray,

I don't entirely understand why you expected this to work. Channels aren't
a valid Ring response body. The error message is essentially telling you
that Compojure has no way of turning the channel object you've returned
into a valid response.

The other problem you have is that the Ring Jetty adapter doesn't have any
support for asynchronous operations.

Another small point. You're using "*" as an argument name, but this isn't
really recommended. This only works by coincidence, and it may be removed
in future versions. Instead use something like:

(GET ["/:brand/:country/:resource" :resource #".*"] [brand country
resource] ...)

- James

On 27 September 2014 00:14, mond  wrote:

> My first core.async program ... all works outside of the web app but barfs
> once I put the functions inside a web container. I hope somebody in the
> group can point to my obvious mistake...
>
> The idea is that the function 'respond-within-sla' will give back a result
> or a come back later message after N milliseconds. It is passed a number of
> ms, three functions and the arguments for the final function ... which is
> the one that should operate within the SLA.
>
> (defn respond-within-sla [expected-result-milliseconds respond-ok
> respond-later data-fetcher & args]
>   (let [data-channel (timeout expected-result-milliseconds)]
> (go (if-let [data (   ((async/close! data-channel)
>(respond-ok data))
>   (respond-later)))
> (go
>   (>! data-channel (apply data-fetcher args)
>
> To keep the volume of code to parse to a minimum I have made a few toy
> functions that demonstrate the failure...
>
> ; test funcs
>
> (defn ok [data]
>   (prn (str "send HTTP 200 ... got data " data)))
>
> (defn later []
>   (prn (str "send HTTP 202 ... request received, come back later")))
>
> (defn fetcher [arg1 arg2 arg3]
>   (prn (str "fetching data with args " arg1 " " arg2 " " arg3))
>   "response-data")
>
> (defn failer [& args]
>   (Thread/sleep 1000)
>   (str "never gets here " args))
>
> ; test funcs
>
> (defn ok [data]
>   (prn (str "send HTTP 200 ... got data " data)))
>
> (defn later []
>   (prn (str "send HTTP 202 ... request received, come back later")))
>
> (defn fetcher [arg1 arg2 arg3]
>   (prn (str "fetching data with args " arg1 " " arg2 " " arg3))
>   "response-data")
>
> (defn failer [& args]
>   (Thread/sleep 1000)
>   (str "never gets here " args))
>
> (defn generate-response [brand country resource]
>   (let [sla (or (env :sla-milliseconds) 100)]
> (respond-within-sla sla ok later fetcher brand country resource)))
>
> (defn generate-fail [brand country resource]
>   (let [sla (or (env :sla-milliseconds) 100)]
> (respond-within-sla sla ok later failer brand country resource)))
>
> From within the REPL it all works fine...
>
> (generate-response "A" "B" "C")
> => # clojure.core.async.impl.channels.ManyToManyChannel@4b7ae3f7>
> "fetching data with args A B C"
> "send HTTP 200 ... got data response-data"
> (generate-fail "A" "B" "C")
> => # clojure.core.async.impl.channels.ManyToManyChannel@4eb8b5a9>
> "send HTTP 202 ... request received, come back later"
>
> Here is the compojure route..
>
> (defroutes app
>(GET "/:brand/:country/*" [brand country *]
> (generate-response brand country *))
>
>(ANY "*" []
> (route/not-found "You must use a REST style to specify
> brand and country keys in the URL")))
>
> If I now start it up 'lein run' and try to exercise the functions from the
> web server...
>
> $ curl -I http://localhost:5000/A/B/D.jpg
> HTTP/1.1 500 Server Error
> Date: Fri, 26 Sep 2014 23:02:03 GMT
> Content-Length: 0
> Connection: close
> Server: Jetty(7.6.8.v20121106)
>
> And on the server I see this:
>
> $ lein run
> Compiling redirector.web
> 2014-09-27 01:01:48.426:INFO:oejs.Server:jetty-7.6.8.v20121106
> 2014-09-27 01:01:48.458:INFO:oejs.AbstractConnector:Started
> SelectChannelConnector@0.0.0.0:5000
> 2014-09-27 01:02:03.535:WARN:oejs.AbstractHttpConnection:/A/B/D.jpg
> java.lang.IllegalArgumentException: No implementation of method: :render
> of protocol: #'compojure.response/Renderable found for class:
> clojure.core.async.impl.channels.ManyToManyChannel
> at clojure.core$_cache_protocol_fn.invoke(core_deftype.clj:544)
> at 

core.async | compojure ... odd error ... help!!

2014-09-26 Thread mond
My first core.async program ... all works outside of the web app but barfs 
once I put the functions inside a web container. I hope somebody in the 
group can point to my obvious mistake...

The idea is that the function 'respond-within-sla' will give back a result 
or a come back later message after N milliseconds. It is passed a number of 
ms, three functions and the arguments for the final function ... which is 
the one that should operate within the SLA.

(defn respond-within-sla [expected-result-milliseconds respond-ok 
respond-later data-fetcher & args]
  (let [data-channel (timeout expected-result-milliseconds)]
(go (if-let [data (! data-channel (apply data-fetcher args)

To keep the volume of code to parse to a minimum I have made a few toy 
functions that demonstrate the failure...

; test funcs

(defn ok [data]
  (prn (str "send HTTP 200 ... got data " data)))

(defn later []
  (prn (str "send HTTP 202 ... request received, come back later")))

(defn fetcher [arg1 arg2 arg3]
  (prn (str "fetching data with args " arg1 " " arg2 " " arg3))
  "response-data")

(defn failer [& args]
  (Thread/sleep 1000)
  (str "never gets here " args))

; test funcs

(defn ok [data]
  (prn (str "send HTTP 200 ... got data " data)))

(defn later []
  (prn (str "send HTTP 202 ... request received, come back later")))

(defn fetcher [arg1 arg2 arg3]
  (prn (str "fetching data with args " arg1 " " arg2 " " arg3))
  "response-data")

(defn failer [& args]
  (Thread/sleep 1000)
  (str "never gets here " args))

(defn generate-response [brand country resource]
  (let [sla (or (env :sla-milliseconds) 100)]
(respond-within-sla sla ok later fetcher brand country resource)))

(defn generate-fail [brand country resource]
  (let [sla (or (env :sla-milliseconds) 100)]
(respond-within-sla sla ok later failer brand country resource)))

>From within the REPL it all works fine...

(generate-response "A" "B" "C")
=> #
"fetching data with args A B C"
"send HTTP 200 ... got data response-data"
(generate-fail "A" "B" "C")
=> #
"send HTTP 202 ... request received, come back later"

Here is the compojure route..

(defroutes app
   (GET "/:brand/:country/*" [brand country *]
(generate-response brand country *))

   (ANY "*" []
(route/not-found "You must use a REST style to specify 
brand and country keys in the URL")))

If I now start it up 'lein run' and try to exercise the functions from the 
web server...

$ curl -I http://localhost:5000/A/B/D.jpg
HTTP/1.1 500 Server Error
Date: Fri, 26 Sep 2014 23:02:03 GMT
Content-Length: 0
Connection: close
Server: Jetty(7.6.8.v20121106)

And on the server I see this:

$ lein run
Compiling redirector.web
2014-09-27 01:01:48.426:INFO:oejs.Server:jetty-7.6.8.v20121106
2014-09-27 01:01:48.458:INFO:oejs.AbstractConnector:Started 
SelectChannelConnector@0.0.0.0:5000
2014-09-27 01:02:03.535:WARN:oejs.AbstractHttpConnection:/A/B/D.jpg
java.lang.IllegalArgumentException: No implementation of method: :render of 
protocol: #'compojure.response/Renderable found for class: 
clojure.core.async.impl.channels.ManyToManyChannel
at clojure.core$_cache_protocol_fn.invoke(core_deftype.clj:544)
at compojure.response$fn__213$G__208__220.invoke(response.clj:9)
at compojure.core$make_route$fn__332.invoke(core.clj:100)
at compojure.core$if_route$fn__320.invoke(core.clj:46)
at compojure.core$if_method$fn__313.invoke(core.clj:33)
at compojure.core$routing$fn__338.invoke(core.clj:113)
at clojure.core$some.invoke(core.clj:2515)
at compojure.core$routing.doInvoke(core.clj:113)
at clojure.lang.RestFn.applyTo(RestFn.java:139)
at clojure.core$apply.invoke(core.clj:626)
at compojure.core$routes$fn__342.invoke(core.clj:118)
at clojure.lang.Var.invoke(Var.java:379)
at 
ring.middleware.keyword_params$wrap_keyword_params$fn__534.invoke(keyword_params.clj:35)
at 
ring.middleware.nested_params$wrap_nested_params$fn__576.invoke(nested_params.clj:84)
at ring.middleware.params$wrap_params$fn__507.invoke(params.clj:64)
at 
ring.middleware.multipart_params$wrap_multipart_params$fn__612.invoke(multipart_params.clj:118)
at ring.middleware.flash$wrap_flash$fn__1286.invoke(flash.clj:35)
at ring.middleware.session$wrap_session$fn__1273.invoke(session.clj:98)
at ring.adapter.jetty$proxy_handler$fn__1426.invoke(jetty.clj:18)
at 
ring.adapter.jetty.proxy$org.eclipse.jetty.server.handler.AbstractHandler$ff19274a.handle(Unknown
 
Source)
at 
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:363)
at 
org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:483)
at 
org.eclipse

Re: Compojure routing of www and api content

2014-08-08 Thread Gary Verhaegen
Maybe post your (minimal) complete code on a github project or something,
to make it easier for us to reproduce and diagnose?

On Thursday, 7 August 2014, Jonathon McKitrick  wrote:

> Let me clarify.  I removed the 'not-found' route and the api calls all
> return an empty response.
>
>
> --
> Jonathon McKitrick
>
>
> On Thu, Aug 7, 2014 at 3:14 PM, Jonathon McKitrick  > wrote:
>
>> Right, I tried removing that as well, and Friend still fails, and the api
>> routes fail as well.
>>
>>
>> --
>> Jonathon McKitrick
>>
>>
>> On Thu, Aug 7, 2014 at 2:54 PM, James Reeves > > wrote:
>>
>>> Compojure routes are checked in order until one matches. You've set up
>>> your www-routes to match all possible routes, as you have a "catch-all"
>>> not-found route at the bottom.
>>>
>>> - James
>>>
>>>
>>> On 7 August 2014 13:17, Jonathon McKitrick >> > wrote:
>>>
>>>> I'm serving up some html and js content, and using handler/site for
>>>> that.  I have a separate handler/api group of routes under the "/api"
>>>> context.
>>>>
>>>> If I include the api routes before the site routes, the site works
>>>> fine.  If the www routes come first, the api calls fail, probably because
>>>> the (route/resources "/") at the end of the site routes catches that call
>>>> and returns null.
>>>>
>>>> OTOH, if I try to use friend with the api routes, it breaks the friend
>>>> wrapping of the www calls.
>>>>
>>>> (defroutes api-routes
>>>>   (context "/api" []
>>>> .
>>>>(route/not-found "ERROR")))
>>>>
>>>> (defroutes www-routes
>>>>   (GET "/admin" req (friend/authorize #{::admin} "Admin only"))
>>>>   (GET "/authorized" req (friend/authorize #{::user} "Users only"))
>>>>   (GET "/home" [] (response/file-response "home.html" {:root
>>>> "resources/public"}))
>>>>   (GET "/login" [] (response/file-response "login.html" {:root
>>>> "resources/public"}))
>>>>   (friend/logout (ANY "/logout" req (response/redirect "/")))
>>>>   (GET "/" [] (response/redirect "index.html"))
>>>>   (route/resources "/")
>>>>   (route/not-found "Not Found"))
>>>>
>>>> (def app
>>>>   (routes
>>>>(-> www-routes
>>>>(friend/authenticate {;:allow-anon? true
>>>>  ;;:login-uri "/login.html"
>>>>  ;:default-landing-uri "/"
>>>>  ;:redirect-on-auth? "/home"
>>>>  ;:unauthorized-handler #(response/status
>>>> (response/response "NO") 401)
>>>>  ;:login-failure-handler
>>>> #(response/response "OOPS")
>>>>  :credential-fn (partial
>>>> creds/bcrypt-credential-fn users)
>>>>  :workflows [(workflows/interactive-form)]})
>>>>;;(wrap-resource "public")
>>>>;wrap-content-type
>>>>;wrap-not-modified
>>>>;;wrap-reload
>>>>handler/site)
>>>>(-> api-routes
>>>>handler/api
>>>>;;wrap-reload
>>>>wrap-restful-format)))
>>>>
>>>>  --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Clojure" group.
>>>> To post to this group, send email to clojure@googlegroups.com
>>>> 
>>>> Note that posts from new members are moderated - please be patient with
>>>> your first post.
>>>> To unsubscribe from this group, send email to
>>>> clojure+unsubscr...@googlegroups.com
>>>> 
>>>> 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
>

Re: Compojure routing of www and api content

2014-08-07 Thread Jonathon McKitrick
Let me clarify.  I removed the 'not-found' route and the api calls all
return an empty response.


--
Jonathon McKitrick


On Thu, Aug 7, 2014 at 3:14 PM, Jonathon McKitrick 
wrote:

> Right, I tried removing that as well, and Friend still fails, and the api
> routes fail as well.
>
>
> --
> Jonathon McKitrick
>
>
> On Thu, Aug 7, 2014 at 2:54 PM, James Reeves 
> wrote:
>
>> Compojure routes are checked in order until one matches. You've set up
>> your www-routes to match all possible routes, as you have a "catch-all"
>> not-found route at the bottom.
>>
>> - James
>>
>>
>> On 7 August 2014 13:17, Jonathon McKitrick  wrote:
>>
>>> I'm serving up some html and js content, and using handler/site for
>>> that.  I have a separate handler/api group of routes under the "/api"
>>> context.
>>>
>>> If I include the api routes before the site routes, the site works
>>> fine.  If the www routes come first, the api calls fail, probably because
>>> the (route/resources "/") at the end of the site routes catches that call
>>> and returns null.
>>>
>>> OTOH, if I try to use friend with the api routes, it breaks the friend
>>> wrapping of the www calls.
>>>
>>> (defroutes api-routes
>>>   (context "/api" []
>>> .
>>>(route/not-found "ERROR")))
>>>
>>> (defroutes www-routes
>>>   (GET "/admin" req (friend/authorize #{::admin} "Admin only"))
>>>   (GET "/authorized" req (friend/authorize #{::user} "Users only"))
>>>   (GET "/home" [] (response/file-response "home.html" {:root
>>> "resources/public"}))
>>>   (GET "/login" [] (response/file-response "login.html" {:root
>>> "resources/public"}))
>>>   (friend/logout (ANY "/logout" req (response/redirect "/")))
>>>   (GET "/" [] (response/redirect "index.html"))
>>>   (route/resources "/")
>>>   (route/not-found "Not Found"))
>>>
>>> (def app
>>>   (routes
>>>(-> www-routes
>>>(friend/authenticate {;:allow-anon? true
>>>  ;;:login-uri "/login.html"
>>>  ;:default-landing-uri "/"
>>>  ;:redirect-on-auth? "/home"
>>>  ;:unauthorized-handler #(response/status
>>> (response/response "NO") 401)
>>>  ;:login-failure-handler #(response/response
>>> "OOPS")
>>>  :credential-fn (partial
>>> creds/bcrypt-credential-fn users)
>>>  :workflows [(workflows/interactive-form)]})
>>>;;(wrap-resource "public")
>>>;wrap-content-type
>>>;wrap-not-modified
>>>;;wrap-reload
>>>handler/site)
>>>(-> api-routes
>>>handler/api
>>>;;wrap-reload
>>>wrap-restful-format)))
>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clojure@googlegroups.com
>>> Note that posts from new members are moderated - please be patient with
>>> your first post.
>>> To unsubscribe from this group, send email to
>>> clojure+unsubscr...@googlegroups.com
>>> 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 clojure+unsubscr...@googlegroups.com.
>>>
>>> For more options, visit 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 clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at

Re: Compojure routing of www and api content

2014-08-07 Thread Jonathon McKitrick
Right, I tried removing that as well, and Friend still fails, and the api
routes fail as well.


--
Jonathon McKitrick


On Thu, Aug 7, 2014 at 2:54 PM, James Reeves  wrote:

> Compojure routes are checked in order until one matches. You've set up
> your www-routes to match all possible routes, as you have a "catch-all"
> not-found route at the bottom.
>
> - James
>
>
> On 7 August 2014 13:17, Jonathon McKitrick  wrote:
>
>> I'm serving up some html and js content, and using handler/site for
>> that.  I have a separate handler/api group of routes under the "/api"
>> context.
>>
>> If I include the api routes before the site routes, the site works fine.
>> If the www routes come first, the api calls fail, probably because the
>> (route/resources "/") at the end of the site routes catches that call and
>> returns null.
>>
>> OTOH, if I try to use friend with the api routes, it breaks the friend
>> wrapping of the www calls.
>>
>> (defroutes api-routes
>>   (context "/api" []
>> .
>>(route/not-found "ERROR")))
>>
>> (defroutes www-routes
>>   (GET "/admin" req (friend/authorize #{::admin} "Admin only"))
>>   (GET "/authorized" req (friend/authorize #{::user} "Users only"))
>>   (GET "/home" [] (response/file-response "home.html" {:root
>> "resources/public"}))
>>   (GET "/login" [] (response/file-response "login.html" {:root
>> "resources/public"}))
>>   (friend/logout (ANY "/logout" req (response/redirect "/")))
>>   (GET "/" [] (response/redirect "index.html"))
>>   (route/resources "/")
>>   (route/not-found "Not Found"))
>>
>> (def app
>>   (routes
>>(-> www-routes
>>(friend/authenticate {;:allow-anon? true
>>  ;;:login-uri "/login.html"
>>  ;:default-landing-uri "/"
>>  ;:redirect-on-auth? "/home"
>>  ;:unauthorized-handler #(response/status
>> (response/response "NO") 401)
>>  ;:login-failure-handler #(response/response
>> "OOPS")
>>  :credential-fn (partial
>> creds/bcrypt-credential-fn users)
>>  :workflows [(workflows/interactive-form)]})
>>;;(wrap-resource "public")
>>;wrap-content-type
>>;wrap-not-modified
>>;;wrap-reload
>>handler/site)
>>(-> api-routes
>>handler/api
>>;;wrap-reload
>>wrap-restful-format)))
>>
>>  --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> 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 clojure+unsubscr...@googlegroups.com.
>>
>> For more options, visit 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 clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "Clojure" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/clojure/A-qRAftd6XY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> clojure+unsubscr...@googlegroups.com.
> For more options, visit 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 clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Compojure routing of www and api content

2014-08-07 Thread James Reeves
Compojure routes are checked in order until one matches. You've set up your
www-routes to match all possible routes, as you have a "catch-all"
not-found route at the bottom.

- James


On 7 August 2014 13:17, Jonathon McKitrick  wrote:

> I'm serving up some html and js content, and using handler/site for that.
> I have a separate handler/api group of routes under the "/api" context.
>
> If I include the api routes before the site routes, the site works fine.
> If the www routes come first, the api calls fail, probably because the
> (route/resources "/") at the end of the site routes catches that call and
> returns null.
>
> OTOH, if I try to use friend with the api routes, it breaks the friend
> wrapping of the www calls.
>
> (defroutes api-routes
>   (context "/api" []
> .
>(route/not-found "ERROR")))
>
> (defroutes www-routes
>   (GET "/admin" req (friend/authorize #{::admin} "Admin only"))
>   (GET "/authorized" req (friend/authorize #{::user} "Users only"))
>   (GET "/home" [] (response/file-response "home.html" {:root
> "resources/public"}))
>   (GET "/login" [] (response/file-response "login.html" {:root
> "resources/public"}))
>   (friend/logout (ANY "/logout" req (response/redirect "/")))
>   (GET "/" [] (response/redirect "index.html"))
>   (route/resources "/")
>   (route/not-found "Not Found"))
>
> (def app
>   (routes
>(-> www-routes
>(friend/authenticate {;:allow-anon? true
>  ;;:login-uri "/login.html"
>  ;:default-landing-uri "/"
>  ;:redirect-on-auth? "/home"
>  ;:unauthorized-handler #(response/status
> (response/response "NO") 401)
>  ;:login-failure-handler #(response/response
> "OOPS")
>  :credential-fn (partial
> creds/bcrypt-credential-fn users)
>  :workflows [(workflows/interactive-form)]})
>;;(wrap-resource "public")
>;wrap-content-type
>;wrap-not-modified
>;;wrap-reload
>handler/site)
>(-> api-routes
>handler/api
>;;wrap-reload
>wrap-restful-format)))
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> 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 clojure+unsubscr...@googlegroups.com.
> For more options, visit 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 clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Compojure routing of www and api content

2014-08-07 Thread Jonathon McKitrick
I'm serving up some html and js content, and using handler/site for that.  
I have a separate handler/api group of routes under the "/api" context.

If I include the api routes before the site routes, the site works fine.  
If the www routes come first, the api calls fail, probably because the 
(route/resources "/") at the end of the site routes catches that call and 
returns null.

OTOH, if I try to use friend with the api routes, it breaks the friend 
wrapping of the www calls.

(defroutes api-routes
  (context "/api" []
.
   (route/not-found "ERROR")))

(defroutes www-routes
  (GET "/admin" req (friend/authorize #{::admin} "Admin only"))
  (GET "/authorized" req (friend/authorize #{::user} "Users only"))
  (GET "/home" [] (response/file-response "home.html" {:root 
"resources/public"}))
  (GET "/login" [] (response/file-response "login.html" {:root 
"resources/public"}))
  (friend/logout (ANY "/logout" req (response/redirect "/")))
  (GET "/" [] (response/redirect "index.html"))
  (route/resources "/")
  (route/not-found "Not Found"))

(def app
  (routes
   (-> www-routes
   (friend/authenticate {;:allow-anon? true
 ;;:login-uri "/login.html"
 ;:default-landing-uri "/"
 ;:redirect-on-auth? "/home"
 ;:unauthorized-handler #(response/status 
(response/response "NO") 401)
 ;:login-failure-handler #(response/response 
"OOPS")
 :credential-fn (partial 
creds/bcrypt-credential-fn users)
 :workflows [(workflows/interactive-form)]})
   ;;(wrap-resource "public")
   ;wrap-content-type
   ;wrap-not-modified
   ;;wrap-reload
   handler/site)
   (-> api-routes
   handler/api
   ;;wrap-reload
   wrap-restful-format)))

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to define a compojure route for SSE ?

2014-06-29 Thread Maciej Jaśkowski
> (defn sse [request]
> {:status 200
>  :headers {"Content-Type" "text/event-stream"}
>  :body ch})
>
> (compojure/defroutes app
>  (compojure/GET "/sse" [] sse)
>  (compojure/GET "/" [] "test"))
>

As far as I know, sse should not be defined as 'defn' as you are
effectively returning a function and then your middleware just ignore
it.
Make it sse a 'def' and it should work.

Best,
Maciej

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to define a compojure route for SSE ?

2014-06-29 Thread rogergl
Hi,

I found the following example for SSE:

 (def ch (channel)) ; lamina.core.channel

(defn handler [request]
  (println request)
  (when (= (:uri request) "/event-source")
{:status 200
 :headers {"Content-Type" "text/event-stream"}
 :body ch}))

(defn handler [request]
  (println request)
  (when (= (:uri request) "/event-source")
{:status 200
 :headers {"Content-Type" "text/event-stream"}
 :body ch}))

(def app
  (-> #'handler
  (wrap-file "./files")
  (wrap-resource "./resources")))

(defonce server (start-http-server (wrap-ring-handler #'app) {:port 8080} ))

My naive approach to define a compojure route like this does not work:

(defn sse [request]
    {:status 200
 :headers {"Content-Type" "text/event-stream"}
     :body ch})

(compojure/defroutes app
 (compojure/GET "/sse" [] sse)
 (compojure/GET "/" [] "test"))

Any ideas what I'm doing wrong ?




-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Ring + Compojure new route recognition

2014-04-28 Thread Jarrod Swart
Thank you.

The compojure-app template does something similar, and I was using that 
from LightTable, evaling a (start-server) var.  

This was good info and reminded me what I was doing and how to apply it to 
the new environment.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Ring + Compojure new route recognition

2014-04-27 Thread Brian Craft
I haven't used "lein ring server", but my understanding is that it reloads 
when you write to disk. If you're just using the Eval feature of Fireplace, 
it's not going to write anything to disk, so lein won't know it should 
reload.

I've been using fireplace with the "manual" ring process described here:

https://github.com/mmcgrana/ring/wiki/Interactive-Development

which seems a lot more flexible and convenient. It doesn't require writing 
to disk, so you can, for example, make temporary changes in a library, 
evaluate the form with fireplace, and the server is updated live.

I've been leaving a comment like 

; (defonce server (run-jetty #'handler {:port 8080 :join? false}))

which can be evaluated in fireplace with cp% to start the server. New 
routes are picked up when evaluated in the same fashion.


On Sunday, April 27, 2014 10:22:01 AM UTC-7, Jarrod Swart wrote:
>
> I've noticed that when using Ring + Compojure w/ LightTable the following 
> process will get me access to any newly added routes.
>
> 1. Add a route
> 2. Eval the route NS
> 3. Eval the handler NS
> 4. Check route in browser
> 5. Success
>
> Recently I've begun using Vim + Fireplace.
>
> I cd to my project dir and start a 'lein repl'.  I then startup a 'lein 
> ring server'.
>
> With this setup I can only access newly added routes when I completely 
> restart the server.
>
> What am I doing wrong?
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Ring + Compojure new route recognition

2014-04-27 Thread Jarrod Swart
I've noticed that when using Ring + Compojure w/ LightTable the following 
process will get me access to any newly added routes.

1. Add a route
2. Eval the route NS
3. Eval the handler NS
4. Check route in browser
5. Success

Recently I've begun using Vim + Fireplace.

I cd to my project dir and start a 'lein repl'.  I then startup a 'lein 
ring server'.

With this setup I can only access newly added routes when I completely 
restart the server.

What am I doing wrong?

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


using the same middleware (wrap-multipart-params) with different parameters in one app [ring] [compojure]

2014-04-03 Thread K Livingston
I'm trying to dynamically handle the InputStream in file uploads 
(ring/compojure app via servlet/jetty).  I started with two different 
versions of the wrap-multipart-params, one is basically a NoOp that just 
returns the file name, and the other echoes the file back.  They both work 
fine independently but when I try to bring them both online together, which 
ever store is defined first is the one I see called regardless of handler.

Can I only have one copy of wrap-multipart-params in the whole app?

How can I change how the InputStream is handled depending on the handler?

Do I need to just have the handler return the IO stream and then change the 
behavior in each handler function?

example:
The logging store is called even with POST to /upload-echo.  The echo store 
is never called.

(defroutes file-list-routes
  (GET "/list-content"  request (file-list/show-file-list request))

  (GET "/upload-logging" request 
   (upload/simple-upload-file "upload-logging" request))
  (mp/wrap-multipart-params 
   (POST "/upload-logging" request (upload/upload-logging-file request))
   {:store upload/logging-store})

  (GET "/upload-echo" request 
   (upload/simple-upload-file "upload-echo" request))
  (mp/wrap-multipart-params 
   (POST "/upload-echo" request (upload/upload-echo-file request))
   {:store upload/echo-store})

  );end route list

These routes are then nested into some other context calls and of course 
other middleware, until eventually making it up to the servlet.  There are 
no other calls to wrap-multipart-params in my application.

Thanks for your help,
Kevin

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: ANN: ring-http-response, ring-Swagger, ring-swagger-ui & compojure-api

2014-02-16 Thread Gary Trakhman
I was inches away from reinventing something like this for our company's
codebase.  Maybe you saved us the trouble :-).

Will definitely check it out.


On Sun, Feb 16, 2014 at 3:20 PM, Tommi Reiman wrote:

> Hi all.
>
> We here at Metosin have been developing and using a bunch of small
> utilities for Ring-based web api development. Here they are:
>
> *1) ring-http-response *(https://github.com/metosin/ring-http-response)
>
> Real http status codes for Ring - ported from Spray[1]. There is a
> response function for most of the http-statuses available (ok, found,
> not-found,...) taking either a body, url or nothing as a parameter. In
> addition, for all erroneous responses there is a exception throwing version
> with '!' in the end (bad-request!, not-found!,...). There is also a
> middleware for catching these response exceptions and returning the thrown
> http-response instead. Namespace *ring.util.http-response* can be used to
> replace the original *ring.util.response*.
>
> Should be stable.
>
> *2) ring-swagger* (https://github.com/metosin/ring-swagger)
>
> We wanted there to be a standalone Swagger[2] implementation for Ring, not
> tied to the used routing library. There is already Swag[3] and
> Octohipster[4], but both have strong opinions about routing. Ring-Swagger
> is integrated with Prismatic Schema for data modeling & coercing (should it
> support other validation libs also?). Offers a simple map-based api for
> routing & other higher level web libs to publish their routes.
>
> There is an adapter for Compojure on top of this, more later.
>
> Would be fun to other routing/web libs adapt to this too (should be quite
> straightforward to collect routes from bidi for example)
>
> Not yet feature complete. All feedback & Pull Requests welcome.
>
> *3) ring-swagger-ui* (https://github.com/metosin/ring-swagger-ui)
>
> Maven-packaged version of the Swagger-UI[5]. Follows the version numbers
> of the original npm packages (permission to publish as maven artifact from
> the Reverb guys, thanks guys!). Has some small changes in the ui. All stuff
> can be overridden locally (mainly the index page).
>
> *4) compojure-api* (https://github.com/metosin/compojure-api)
>
> Originally was supposed to be just compojure-swagger, but added other
> stuff to make life of an web api development easier. Everything can be used
> separately, but there is also a *compojure.api.sweet* package, which can
> be used as a single entry point to the library.
>
> Basic Swagger-functionality works with vanilla Compojure but to enable all
> features (better way to setup route meta-data, schema-aware body
> destructuring, return schemas etc.), there is a extended api, with '*' in
> the name of the http-methods (GET*, POST*). Currently the extended api is
> also sitting on top of Compojure and internally overrides a compile-route
> function from *compojure.core* to enable easy way to add meta-data to
> routes. Thinking of re-implementing the new api directly on top of Clout
> instead of trying to sit on top of the (otherwise awesome) Compojure.
>
> Currently work in progress. Acts also as a demo how to use & bind together
> the underlying more stable libs (ring-http-response, ring-swagger
> &ring-swagger-ui).
>
> *5) compojure-api-examples* (
> https://github.com/metosin/compojure-api-examples)
>
> A sample minimalistic project to see things in action and to start
> creating schema-aware documented web apis.
>
> ...
>
> Hopefully some of the stuff is found useful, on both Github & Clojars. We
> are using (and developing) these anyway with our projects. Also waiting
> eagerly for the @PrismaticEng next web thingie coming out soon(?), whether
> these libs complement or overlap each other.
>
> Would appreciate your comments and thoughts on the concepts or the code.
> Either here or via email: first-name (at) metosin.fi or ikitommi at
> freenode & twitter.
>
> regards,
>
> Tommi
>
> --
>
> [1] http://spray.io
> [2] https://github.com/wordnik/swagger-core/wiki
> [3] https://github.com/narkisr/swag
> [4] https://github.com/myfreeweb/octohipster
> [5] https://github.com/wordnik/swagger-ui
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribe

ANN: ring-http-response, ring-Swagger, ring-swagger-ui & compojure-api

2014-02-16 Thread Tommi Reiman
Hi all.

We here at Metosin have been developing and using a bunch of small 
utilities for Ring-based web api development. Here they are:

*1) ring-http-response *(https://github.com/metosin/ring-http-response)

Real http status codes for Ring - ported from Spray[1]. There is a response 
function for most of the http-statuses available (ok, found, not-found,...) 
taking either a body, url or nothing as a parameter. In addition, for all 
erroneous responses there is a exception throwing version with '!' in the 
end (bad-request!, not-found!,...). There is also a middleware for catching 
these response exceptions and returning the thrown http-response instead. 
Namespace *ring.util.http-response* can be used to replace the original 
*ring.util.response*.

Should be stable.

*2) ring-swagger* (https://github.com/metosin/ring-swagger)

We wanted there to be a standalone Swagger[2] implementation for Ring, not 
tied to the used routing library. There is already Swag[3] and 
Octohipster[4], but both have strong opinions about routing. Ring-Swagger 
is integrated with Prismatic Schema for data modeling & coercing (should it 
support other validation libs also?). Offers a simple map-based api for 
routing & other higher level web libs to publish their routes.

There is an adapter for Compojure on top of this, more later.

Would be fun to other routing/web libs adapt to this too (should be quite 
straightforward to collect routes from bidi for example)

Not yet feature complete. All feedback & Pull Requests welcome.

*3) ring-swagger-ui* (https://github.com/metosin/ring-swagger-ui)

Maven-packaged version of the Swagger-UI[5]. Follows the version numbers of 
the original npm packages (permission to publish as maven artifact from the 
Reverb guys, thanks guys!). Has some small changes in the ui. All stuff can 
be overridden locally (mainly the index page).

*4) compojure-api* (https://github.com/metosin/compojure-api)

Originally was supposed to be just compojure-swagger, but added other stuff 
to make life of an web api development easier. Everything can be used 
separately, but there is also a *compojure.api.sweet* package, which can be 
used as a single entry point to the library.

Basic Swagger-functionality works with vanilla Compojure but to enable all 
features (better way to setup route meta-data, schema-aware body 
destructuring, return schemas etc.), there is a extended api, with '*' in 
the name of the http-methods (GET*, POST*). Currently the extended api is 
also sitting on top of Compojure and internally overrides a compile-route 
function from *compojure.core* to enable easy way to add meta-data to 
routes. Thinking of re-implementing the new api directly on top of Clout 
instead of trying to sit on top of the (otherwise awesome) Compojure.

Currently work in progress. Acts also as a demo how to use & bind together 
the underlying more stable libs (ring-http-response, ring-swagger 
&ring-swagger-ui).

*5) compojure-api-examples* (
https://github.com/metosin/compojure-api-examples)

A sample minimalistic project to see things in action and to start creating 
schema-aware documented web apis.

...

Hopefully some of the stuff is found useful, on both Github & Clojars. We 
are using (and developing) these anyway with our projects. Also waiting 
eagerly for the @PrismaticEng next web thingie coming out soon(?), whether 
these libs complement or overlap each other.

Would appreciate your comments and thoughts on the concepts or the code. 
Either here or via email: first-name (at) metosin.fi or ikitommi at 
freenode & twitter.

regards,

Tommi

--

[1] http://spray.io
[2] https://github.com/wordnik/swagger-core/wiki
[3] https://github.com/narkisr/swag
[4] https://github.com/myfreeweb/octohipster
[5] https://github.com/wordnik/swagger-ui

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [ANN] DACOM: A skeleton app, Leiningen template for Datomic, Compojure, and Om

2014-01-10 Thread Curtis Gagliardi
That's my stack right now, I'll have to check this out and take notes, see 
what we're doing differently.  This is all pretty uncharted territory it 
seems.  Thanks for putting this out there.

On Thursday, January 9, 2014 9:06:34 PM UTC-8, Kevin Bell wrote:
>
> A Leiningen template featuring all of the most popular Clojure 
> technologies that all of the coolest kids are using:
>
> sample project repo 
>
> or
>
> `lein new dacom my-project`
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [ANN] DACOM: A skeleton app, Leiningen template for Datomic, Compojure, and Om

2014-01-10 Thread Manuel Paccagnella
Thank you for putting the time on building and documenting this template! 
I'm going to test some ideas with it.

Il giorno venerdì 10 gennaio 2014 06:06:34 UTC+1, Kevin Bell ha scritto:
>
> A Leiningen template featuring all of the most popular Clojure 
> technologies that all of the coolest kids are using:
>
> sample project repo 
>
> or
>
> `lein new dacom my-project`
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[ANN] DACOM: A skeleton app, Leiningen template for Datomic, Compojure, and Om

2014-01-09 Thread Kevin Bell
A Leiningen template featuring all of the most popular Clojure technologies 
that all of the coolest kids are using:

sample project repo 

or

`lein new dacom my-project`

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Compojure session handling across concurrent requests

2013-11-19 Thread Binita
Hello everyone,

I have a long running POST request which updates the session with the 
requested result.

Now, when such concurrent POST requests are made from the same session, the 
updates done
in concurrent request don't get visibility across each other.

The effect is that, the session updates done in few concurrent request are 
eventually lost.

How is such a scenario supposed to be handled ?

Thanks
Binita

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Any interest in Compojure/Ring screencasts?

2013-11-02 Thread Rudi Engelbrecht
Count me in

Rudi



On 30 Oct 2013, at 1:36 PM, Yuan  wrote:

> Count me in too..
> 
> >_>
> Best regards
> -
> Yuan blog github
> 
> 
> 
> 
> 
> On Wed, Oct 30, 2013 at 7:19 AM, Luc Prefontaine 
>  wrote:
> Count me in,
> 
> Luc P.
> 
> 
> > I'm considering putting together a screencast, or a series of screencasts,
> > based on my Functional Web
> > Architecture
> > talk.
> > The base presentation would be improved, and I'd probably wind up going
> > into more detail on certain topics. I'll probably charge a small fee
> > (perhaps $10 or so) to cover costs.
> >
> > Would there be any interest in this?
> >
> > - James
> >
> > --
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Clojure" group.
> > To post to this group, send email to clojure@googlegroups.com
> > Note that posts from new members are moderated - please be patient with 
> > your first post.
> > To unsubscribe from this group, send email to
> > clojure+unsubscr...@googlegroups.com
> > 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 clojure+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/groups/opt_out.
> >
> --
> Luc Prefontaine sent by ibisMail!
> 
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> 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 clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
> 
> 
> -- 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> 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 clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Any interest in Compojure/Ring screencasts?

2013-11-01 Thread John Jackaman
+1

On Tuesday, October 29, 2013 5:39:05 PM UTC-5, James Reeves wrote:
>
> I'm considering putting together a screencast, or a series of screencasts, 
> based on my Functional Web 
> Architecture talk. 
> The base presentation would be improved, and I'd probably wind up going 
> into more detail on certain topics. I'll probably charge a small fee 
> (perhaps $10 or so) to cover costs.
>
> Would there be any interest in this?
>
> - James
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Any interest in Compojure/Ring screencasts?

2013-11-01 Thread Nando Breiter
Yes.



Aria Media Sagl
Via Rompada 40
6987 Caslano
Switzerland

+41 (0)91 600 9601
+41 (0)76 303 4477 cell
skype: ariamedia


On Fri, Nov 1, 2013 at 9:19 AM, Josh Kamau  wrote:

> I am interested.
>
> Thanks.
> Josh
>
>
> On Fri, Nov 1, 2013 at 3:57 AM, Tilak Thapa  wrote:
>
>> +1, @James, i'm in.
>>
>>
>> On Wednesday, October 30, 2013 4:32:18 AM UTC+5:45, Russell Whitaker
>> wrote:
>>
>>> I, for one, would happily pay (my employer's) money for such a thing.
>>>
>>> R
>>>
>>> On Tue, Oct 29, 2013 at 3:39 PM, James Reeves 
>>> wrote:
>>> > I'm considering putting together a screencast, or a series of
>>> screencasts,
>>> > based on my Functional Web Architecture talk. The base presentation
>>> would be
>>> > improved, and I'd probably wind up going into more detail on certain
>>> topics.
>>> > I'll probably charge a small fee (perhaps $10 or so) to cover costs.
>>> >
>>> > Would there be any interest in this?
>>> >
>>> > - James
>>>
>>> --
>>> Russell Whitaker
>>> http://twitter.com/**OrthoNormalRuss
>>>
>>  --
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> 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 clojure+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>  --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> 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 clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Any interest in Compojure/Ring screencasts?

2013-11-01 Thread Josh Kamau
I am interested.

Thanks.
Josh


On Fri, Nov 1, 2013 at 3:57 AM, Tilak Thapa  wrote:

> +1, @James, i'm in.
>
>
> On Wednesday, October 30, 2013 4:32:18 AM UTC+5:45, Russell Whitaker wrote:
>
>> I, for one, would happily pay (my employer's) money for such a thing.
>>
>> R
>>
>> On Tue, Oct 29, 2013 at 3:39 PM, James Reeves 
>> wrote:
>> > I'm considering putting together a screencast, or a series of
>> screencasts,
>> > based on my Functional Web Architecture talk. The base presentation
>> would be
>> > improved, and I'd probably wind up going into more detail on certain
>> topics.
>> > I'll probably charge a small fee (perhaps $10 or so) to cover costs.
>> >
>> > Would there be any interest in this?
>> >
>> > - James
>>
>> --
>> Russell Whitaker
>> http://twitter.com/**OrthoNormalRuss 
>>
>  --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> 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 clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Any interest in Compojure/Ring screencasts?

2013-10-31 Thread Tilak Thapa
+1, @James, i'm in.

On Wednesday, October 30, 2013 4:32:18 AM UTC+5:45, Russell Whitaker wrote:
>
> I, for one, would happily pay (my employer's) money for such a thing. 
>
> R 
>
> On Tue, Oct 29, 2013 at 3:39 PM, James Reeves 
> > 
> wrote: 
> > I'm considering putting together a screencast, or a series of 
> screencasts, 
> > based on my Functional Web Architecture talk. The base presentation 
> would be 
> > improved, and I'd probably wind up going into more detail on certain 
> topics. 
> > I'll probably charge a small fee (perhaps $10 or so) to cover costs. 
> > 
> > Would there be any interest in this? 
> > 
> > - James 
>
> -- 
> Russell Whitaker 
> http://twitter.com/OrthoNormalRuss 
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Any interest in Compojure/Ring screencasts?

2013-10-31 Thread Scott Thoman


On Thursday, October 31, 2013 7:28:39 PM UTC-4, Amr Malik wrote:
>
> Yes please, I'd be interested :)
>
> -A
>
> On Tuesday, 29 October 2013 18:39:05 UTC-4, James Reeves wrote:
>>
>> I'm considering putting together a screencast, or a series of 
>> screencasts, based on my Functional Web 
>> Architecture talk. 
>> The base presentation would be improved, and I'd probably wind up going 
>> into more detail on certain topics. I'll probably charge a small fee 
>> (perhaps $10 or so) to cover costs.
>>
>> Would there be any interest in this?
>>
>> - James
>>
>
I'd be interested as well (especially topics that I can apply to exposing 
RESTful services over http).

/stt

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Any interest in Compojure/Ring screencasts?

2013-10-31 Thread Amr Malik
Yes please, I'd be interested :)

-A

On Tuesday, 29 October 2013 18:39:05 UTC-4, James Reeves wrote:
>
> I'm considering putting together a screencast, or a series of screencasts, 
> based on my Functional Web 
> Architecture talk. 
> The base presentation would be improved, and I'd probably wind up going 
> into more detail on certain topics. I'll probably charge a small fee 
> (perhaps $10 or so) to cover costs.
>
> Would there be any interest in this?
>
> - James
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


  1   2   3   >