by Udo · 13y ago · 0 comments
mysite.com/games/test_game
instead of something like
mysite.com/games?id=test_game
Which would be the PHP solution?
I fail to see what this has to do with using PHP or not. The entire question has a background untouched by any knowledge about either Node or PHP. The answer, however well and reasonably written, is about Node only. The title implies a discussion about why to prefer Node over PHP which is just not there.Contrary to the title, the subject here is not PHP at all.
One line of mod_rewrite in an .htaccess file to rout everything to a 3 or 4 line controller script is all it takes.
That being said - Node looks cool and I want to build something in it.
URL arguments with '?' and '&' should specify a secondary "meta" mapping for things like sorting or filtering, that still acts on basically the same resource.
Of course, there are a lot of sites that use .htaccess to implement routing rules, but I'm not a huge fan of that. All things being equal, I believe just passing the virtual path to an /index.php endpoint is preferable - and it's pretty much what other languages and frameworks do in these cases as well.