Create config.local.js
with the following:
var p = require('../package.json');
var version = p.version.split('.').shift();
module.exports = {
restApiRoot: '/api' + (version > 0 ? '/v' + version : ''),
host: process.env.HOST || 'localhost',
port: process.env.PORT || 3000
};
API path's will look like /api/v1
using the app's major version. If the app's major version is 0, then the path is simply /api
.
How can it helpful in the following scenario?
Android 4.5.6 version
GET http://localhost:3000/api/v1/Users
Android 4.6.1 version
GET http://localhost:3000/api/v2/Users
For iPhone X versioin
GET http://localhost:3000/api/v3/Users
Based on package.json logic, do I need to run loopback on three different instances for each version (v1, v2, v3)?