I want to have 2 models with same name (Account in this case) in the same LoopBack app but mounted at different points:
For example: http://localhost:3000/api1/Accounts
and
http://localhost:3000/api2/Accounts
? Is it possible to do this?
I tried requiring two LoopBack objects, mounting them at different paths in the app and creating the models in them; but when I register the model with the app, the last call to app.model is the one which takes effect. Is there a way to work around this ?
var loopback = require('loopback');
var loopback2 = require('loopback');
var app = loopback();
app.use('/api1', loopback.rest());
app.use('/api2', loopback2.rest());
app.listen(3000);
app.dataSource('testMySql', dsConfig);
var config = { dataSource: 'testMySql'};
var newmodel = loopback.createModel(model);
app.model(newmodel, config);
newmodel2 = loopback2.createModel(model);
app.model(newmodel2, config);