-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
URI questions #15
Comments
Heh, I'm quite surprised: the README goes into this at length, it's the main function in Snooze!! I think you have to decide first what your REST resource is. Is it "API"? If so your route should be `(defroute api (:get :text/html version string) ...) And then If however, you want two rest resources: "api/v1/hello" and "api/v1/test", then you should write two routes defining two resources.
and
|
When I do this... (snooze:defroute api/v1/start (:get "text/plain") I get a 404 error. Hunchentoot reports this: 127.0.0.1 - [2018-11-20 08:38:39] "GET /api/v1/start/ HTTP/1.1" 404 13 "-" "Go-http-client/1.1" |
Indeed snooze seems to have trouble when the resource name has "/" in it. This seems like a bug, I will take a look at it. |
This works for you, right?
And then accessing |
It's not a bug, it's like this for design. Snooze provides a customization point for your case,
So you need to write a suitable function for something that will split the string up to three "/" in the string and split it there, returning both parts as separate |
Yes, that works.
…On Tue., Nov. 20, 2018, 10:29 a.m. João Távora ***@***.*** wrote:
This works for you, right?
(snooze:defroute foo (:get "text/plain") "bar")
And then accessing http://localhost:<yourport>/foo right?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#15 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAFfieaB8gl_rV5GWZ9ic35wuy7j-LLxks5uxB_EgaJpZM4Yp8R9>
.
|
Thanks.. I'll have a look later today!
…On Tue., Nov. 20, 2018, 10:31 a.m. João Távora ***@***.*** wrote:
It's not a bug, it's like this for design. Snooze provides a customization
point for your case, snooze:*resource-name-function*. Here is its doc,
which you can find in the api.lisp file:
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#15 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAFfiT06hlS6TCHRNLOqah4Upnuz10xjks5uxCBKgaJpZM4Yp8R9>
.
|
I'm also having some trouble here. I hope I didn't overlook something but I've read the readme a few times now. Basically I have two routes:
When compiling this I get an error on the second definition:
In principle it's clear, two methods with the same name. But my lacking CL knowledge doesn't let me overcome this. |
When you use Now, this should be enough to hint that a route in Snooze is only a method in a generic function. So when you do the first You should learn about "Generic Functions". In Snooze, a REST resource is represented by a generic function. The methods of the generic functions are the different routes that provide access to that resource. Different types of access. Read access is a Also, in your case, it seems like you want a |
Great. This was a good pointer. Got it working with &optional.
Are you refering to the |
I believe you can close this one as well. |
Yes, and its counterpart You could also use |
I was hoping to have URIs like...
http://localhost/api/v1/hello
http://localhost/api/v1/test
But I see that this doesn't work:
(defroute api/v1/hello ...
I don't see any mention of how method names map to paths. How would I do something like this?
Thanks!
The text was updated successfully, but these errors were encountered: