I would like to write non-trivial dynamic clean URLs in node.js. For example
mynodeserver.com/browse/itemid
instead of
mynodeserver.com/browse?id=itemid
Right now my static clean urls (browse,login,register,etc) are based on string comparison, which obviously is not the complete solution for this problem.
var pathname = url.parse(request.url).pathname;
//check if there is a request handler for this path
if (typeof handle[ pathname ] === 'function')
{
handle[pathname]( response, request, postData );
}
Is there a native way (or light plugin) to write non-trivial clean URLs?
I'm using Cloud9 IDE