Hi Tim,

Good to hear you're finding Jig useful.

There isn't any explicit support for Ring in Jig yet, it's just Pedestal 
services right now. The separation of jig.web.server and jig.web.app into 2 
components is to allow multiple 'virtual hosts' to share the same Jetty 
server, if necessary. 

It's a third component, usually your own, that actually adds routes to a 
virtual host. See the ReadmeComponent in 
examples/docsite/src/examples/docsite/core.clj 
here<https://github.com/juxt/jig/blob/master/examples/docsite/src/examples/docsite/core.clj#L75>.
 
It adds routes in its init phase. 

The idea is that other components can be contribute routes in the same way, 
so you have the option of breaking up a website into modules.

The nice thing about Pedestal services is that hyperlinks can be generated 
using the url-for functionality it provides. If you use this feature 
consistently, you can treat the jig.web.app as an anchor on which to hook 
multiple applications and configure the URL tree accordingly. I'm intrigued 
by this url-for feature and wanted to experiment with it with Jig.

Since Compojure doesn't have this automatic ability to create links from 
handler vars, it's likely you'll want to set it up manually. Here's a 
suggestion for how to do this:

1. Create a Ring server component. 

2. In the init phase, add an empty vector called :routes. Other components 
can depend on this one, and in their init phase, they concat their routes 
to this vector. 

3. Then, in its start phase, the Ring server component composes the routes 
together (using Compojure's routes function) and creates and starts the 
server, placing the server in the system map so that it can be found and 
stopped in its stop phase.

Remember that you don't need to use any reloading tricks described by 
Ring<https://github.com/ring-clojure/ring/wiki/Interactive-Development#iii-manually>,
 
such as passing a var to run-jetty rather than the handler itself. Nor do 
you need :reload and any file status detection. 

What I really like about Stuart's workflow is that it allows you to do away 
with these 'dev versus prod' modes, you just code everything in 'prod' mode 
(i.e. there is only one mode) and let the reset handle the dev reload. This 
makes code simpler and ensures you are developing and testing what the 
users get, not a development 'version' that approximates to it.

Regards,

Malcolm












On Monday, October 21, 2013 1:41:43 AM UTC+1, frye wrote:
>
> Also, is there a Google Group for Jig? I'm playing around with it, can see 
> the potential, and already have some questions. Anyways, in the meantime, 
> I'll keep digging. I'm finding jig really useful so far. 
>
>
> *A)* As taken from the example, I'm using the Jetty :server 
> component<https://github.com/juxt/jig/blob/master/config/config.clj#L6>. 
> I'm trying to figure out how to pass in my Compojure route 
> handler<https://github.com/weavejester/compojure-example/blob/master/src/compojure/example/routes.clj>
>  (also 
> see<http://weavejester.github.io/compojure/compojure.handler.html#var-site>) 
> to 
> jetty. This is how its done 
> manually<https://github.com/ring-clojure/ring/wiki/Interactive-Development#iii-manually>.
>  
> But obviously, I need to fit that into the jig framework. 
>
>
>
>   :server {:jig/component jig.web.server/Component      ;; how do I pass in 
> my Compojure route handler ? 
>
>            :io.pedestal.service.http/port 8000
>
>
>            :io.pedestal.service.http/type :jetty
>            }
>
>
>
> *B)* Same thing with Pedestal. I want to be able to pass in my app's 
> routing table. But I don't quite grok how to do that, from the examples (
> here <https://github.com/juxt/jig/blob/master/config/config.clj#L28> and 
> here <https://github.com/juxt/jig/blob/master/src/jig/web/app.clj>). 
>
>
>
>   :juxtweb/web {:jig/component jig.web.app/Component    ;; how do I pass in 
> my routing table of handlers ? 
>
>                 :jig/dependencies [:server]
>
>                 :jig/scheme :http
>
>
>                 :jig/hostname "localhost"
>                 :jig.web/server :server
>
>                 }
>
>
>
> Thanks 
>
> Tim Washington 
> Interruptsoftware.ca / Bkeeping.com 
>
>
>
> On Thu, Oct 17, 2013 at 7:30 PM, zcaudate <z...@caudate.me 
> <javascript:>>wrote:
>
>> Would it be possible to put up a video of a typical workflow example with 
>> pedestal. It's quite difficult for me to piece everything together just by 
>> reading the documentation.
>>
>> Chris
>>
>>

-- 
-- 
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.

Reply via email to