We need to Expose REST endpoint. There are three parameters, how to make those optional. Requirement is it should work with any one of those parameters.
e.g. http://server:port/v1/api/test-api/userId/UnameName/userEmail
app.get('v1/api/test-api/:userId/:userName/:userEmail', function(req, res){
});
When we call by passing all three parameters it works fine. But we want to make it work by passing only userId or any of these three parameters. When we pass less parameters its giving error Cannot GET /v1/api/test-api/test5/123
How to make parameters optional while exposing endpoint?
you need to structure the route like this:
app.get('path/:required/:optional?*, ...)