PuercoPop / cl-knowledge-base

throwaway prototype
1 stars 0 forks source link

Consider moving to "snooze" just for kicks #1

Open joaotavora opened 8 years ago

joaotavora commented 8 years ago

Hi @PuercoPop, I see you've moved from clack's route handling to hunchentoot's. Can I suggest you try snooze? You can use it with either clack or hunchentoot, so you keep all the nice server-agnosticness that clack gives you...

PuercoPop commented 8 years ago

Hi Joao,

Snooze seems just what I was looking for! One thing that is missing in hunchentoot, wookie and lisp in general is a URL router. Snooze, seems to be a router that maps http requests to CLOS. Two things I'd consider w/o trying it out would be to more examples of to what url would a defroute map to and make a genpath function always and allow a keyword argument to override the name.

I'll try it out.

joaotavora commented 8 years ago

more examples of to what url would a defroute

True. What routes are you trying to generate? A practical example is always a good example...

make a genpath function always

Hmm, with a synthesized name like defstruct does? I normally don't like those approaches, but I suggest that you make your own macro. I wouldn't object superstrongly to adding defroute* to snooze.

allow a keyword argument to override the name

What do you mean? What name?

Or do you mean a super-generic PATH-TO (RESOURCE &REST ARGS)?

PuercoPop commented 8 years ago

What do you mean? What name? the synthesized name, like defstruct I was thinking of, but a super generic path-to/url-for seems like a better idea.

True. What routes are you trying to generate? A practical example is always a good example... The defaults work for me, but the tutorial could illustrate the mapping through repetition. Something along the lines of

(defroute user (:post :/) &optional user-id &key email password
   ..)

would map a request to /user/123/ with a post body of email: "joe@duff.com", password: "secret" to a call to the user 'function' with user-id "123", email "joe@duff.com" "secret". And similar examples for get, and post to drive the point through.

In an unrelated topic, I still have to tackle search before starting to work on content, I was thinking of trying simple search and montezuma. Do you have any other suggestions?