Here are many different routes defined which you can all test out and see the results.
server.get('/user/:id', function(request, response) { response.render('routing/output', { title: 'Client Express JS - /user/:id - Basic and advanced routing', source: 'client', processedRequest: processRequestObject(request) // used to display the request values }); });
server.get('/users/:id?', function(request, response) { response.render('routing/output', { title: 'Client Express JS - /users/:id? - Basic and advanced routing', source: 'client', processedRequest: processRequestObject(request) // used to display the request values }); });
server.get('/files/*', function(request, response) { response.render('routing/output', { title: 'Client Express JS - /files/* - Basic and advanced routing', source: 'client', processedRequest: processRequestObject(request) // used to display the request values }); });
server.get('/files/*.*', function(request, response) { response.render('routing/output', { title: 'Client Express JS - /files/*.* - Basic and advanced routing', source: 'client', processedRequest: processRequestObject(request) // used to display the request values }); });
server.get('/person/:id/:operation?', function(request, response) { response.render('routing/output', { title: 'Client Express JS - /person/:id/:operation? - Basic and advanced routing', source: 'client', processedRequest: processRequestObject(request) // used to display the request values }); });
server.get('/product.:format', function(request, response) { response.render('routing/output', { title: 'Client Express JS - /product.:format - Basic and advanced routing', source: 'client', processedRequest: processRequestObject(request) // used to display the request values }); });
server.get('/products.:format?', function(request, response) { response.render('routing/output', { title: 'Client Express JS - /products.:format? - Basic and advanced routing', source: 'client', processedRequest: processRequestObject(request) // used to display the request values }); });
server.get('/persons/:id.:format?', function(request, response) { response.render('routing/output', { title: 'Client Express JS - /persons/:id.:format? - Basic and advanced routing', source: 'client', processedRequest: processRequestObject(request) // used to display the request values }); });
server.get(/\/regex\/([^\/]+)\/?/, function(request, response) { response.render('routing/output', { title: 'Client Express JS - /\/regex\/([^\/]+)\/?/ - Basic and advanced routing', source: 'client', processedRequest: processRequestObject(request) // used to display the request values }); });
server.get(/^\/regexp?(?:\/(\d+)(?:\.\.(\d+))?)?/, function(request, response) { response.render('routing/output', { title: 'Client Express JS - /^\/regexp?(?:\/(\d+)(?:\.\.(\d+))?)?/ - Basic and advanced routing', source: 'client', processedRequest: processRequestObject(request) // used to display the request values }); });