News for hackers. Stuff that matters.
Re:“Why are you using Node.js rather than PHP?” by sparkygoblue on Saturday May 25, 2013 @05:27PM (#5768919)
I noticed that as well. I think he was implying that the first URL structure isn't possible in PHP, which of course is not true.
Re:“Why are you using Node.js rather than PHP?” by bdcravens on Saturday May 25, 2013 @05:33PM (#5768937)
Likewise, you can pass and parse URL parameters in an Express app (or any framework for that matter) if so inclined
Re:“Why are you using Node.js rather than PHP?” by adamors on Saturday May 25, 2013 @05:46PM (#5768983)
Or just split the $_SERVER['REQUEST_URI'] by '/' and map the request to pages.
Re:“Why are you using Node.js rather than PHP?” by geon on Sunday May 26, 2013 @04:57AM (#5770538)
Imho, '/' should be used to map a specific resource, like a file or a collection of objects in the database.

URL arguments with '?' and '&' should specify a secondary "meta" mapping for things like sorting or filtering, that still acts on basically the same resource.

Re:“Why are you using Node.js rather than PHP?” by ceol on Sunday May 26, 2013 @05:28PM (#5772501)
That's my opinion, as well. However, what about paginating things? A different page is a different set of the same type of object, so it's basically sorting and filtering, but you're returning different content.

    /posts/page/2

    /posts?page=2

    /posts?limit=25&offset=25
I like the third option because it allows the must functionality to the user if they so desire, but it kind of feels like a violation of the "only sorting and filtering" rule.
Re:“Why are you using Node.js rather than PHP?” by kawsper on Saturday May 25, 2013 @08:10PM (#5769435)
Yes, but that can still be a bit complex. I have used https://github.com/chriso/klein.php prior for doing exactly this, but it was a long time ago, the codebase now seems a bit more advanced, and mature.
Re:“Why are you using Node.js rather than PHP?” by krapp on Saturday May 25, 2013 @10:48PM (#5769818)
url routing is one of those things about PHP frameworks I never really understood until I wrote my own. I think if you work with PHP, it's probably something you kind of should know how to do.