Closed jlg7 closed 10 years ago
Hello, The path matching is quite simple. The context + your path concatenated should match with the requested URI. Let me run a few tests on your code.
BTW, if you would like to eliminate the context, passing an empty string should work.
app.use(
rest.rester(
{
context:''
}
)
);
Now you can use a path like '/distributions/:name' without any context.
I checked the code and I'm using underscore.string lib's 'word' function to decompose the URI of the request, that is why it is immune to the '/' string as context and your rest function is called.
Hi there,
Thank you for the reply. That makes sense and sounds like I can save myself an explicit slash and use blank then.
Appreciate the evaluation. I was not sure if "//"
or "/"
should match all the routes defined like /distributions/:name
. I am using this in conjunction with static-serving with connect-rest added to the app first and this was stealing the web root's index page.
Thank you,
@jongeho1
Yes, you can use blank context and will work perfectly. :) I hope everything is convenient for you now.
To put the static pages before any rest function would be recommended if I might say so...
Hi,
Thank you for the node module. It is working great for me. Just trying get clarification around default expected behavior when matching routes, I have a declaration style like this:
"/" is matching all routes which is suspect.
Let me know if you need any additional info.
Thanks, @jongeho1