chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Starting up spiffy for dynamic content


From: Caolan McMahon
Subject: Re: [Chicken-users] Starting up spiffy for dynamic content
Date: Tue, 8 Mar 2016 13:16:08 +0000

Peter, for what it's worth I encountered exactly the same confusion
when I first used spiffy (or rather, I arrived with the same
preconceptions?). Perhaps this might be fixed by adding a clearly
signposted example to the wiki which demonstrates the recommended way
to implement this kind of dynamic content.

On 8 March 2016 at 12:40, Peter Bex <address@hidden> wrote:
> On Tue, Mar 08, 2016 at 12:02:29PM +0000, Norman Gray wrote:
>> It occurred to me that I could/should use the vhost-map to do this
>> dispatching, using something like
>>
>> (vhost-map `((".*" . ,(lambda (continue) ... and ignore (continue)))))
>>
>> But (a) that would clearly be a hack
>
> Actually, that's how it was designed to be used.  Not a hack at all!
>
>> and (b) it appears that that's designed to be able to re-parameterise
>> a request, rather than handle it itself,
>
> It's intended to be used like that, and you *may* re-parameterise (but
> that's not necessary).  The idea is that you can create "components"
> which can be chained together, influencing their sub-components by
> simply parameterising some options and then passing the flow on to
> continue.  The last component in the sequence would then actually
> serve the request.
>
>> so (c) that would clearly be a hack.
>
> Again, that's not a hack but the design.
>
>> Another possibility is to specify the handle-not-found handler, and
>> make sure to start the spiffy server in a context which has no files
>> at all, so that the handle-not-found handler will always be called.
>> But that also feels like a bit of a hack.
>
> That's a bit awkward, but it's an equally valid option.
>
>> The final possibility is to use intarweb directly, but that's
>> unappealing, since it would require me cut-and-pasting quite a lot
>> of the content of spiffy.scm.
>
> Now *that* would be a hack ;)
>
>> Where this is coming from: I'm pretty familiar with the Racket
>> servlet framework which requires, in serve/servlet
>> <http://docs.racket-lang.org/web-server/run.html>, a
>> request->response mapping function.
>>
>> If I'm missing something really obvious, then apologies, and could
>> someone hand me the clue-stick?
>
> I think you're coming at this from a slightly wrong angle with some
> preconceptions that prevent you from using the system as designed,
> because you did figure out how to use it (you came up with two valid
> solutions to the problem) but rejected them offhand.
>
> Cheers,
> Peter
>
> _______________________________________________
> Chicken-users mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/chicken-users
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]