There are some APIs with some versions. i.e. 1. /v1/order/create 2. /order/v2/create
Their is common middleware going to invoke. In middleawre I need version of API (i.e. v1 or v2) to perform some specific task for specific version. I tried with below code but failing for 2nd type of url.
var pieces = req.url.replace(/^\/+/, '').split('/');
var version = pieces[0];
req.version = version || 0;
Please suggest. Thanks
via Dharmraj
No comments:
Post a Comment