I've been moving domain-specific modules+facets to a separate folder within persevere-example-wiki, and mixing them in with the rest upon request using the host. My app.js has another setup, mainly using this code to do the redirect:
pinturaConfig.getDataModel = function(request){
var domain = request.host;
if(path.existsSync("./domains/"+domain+"/datamodel.js")) {
// mixin models into fullModel, userModel & publicModel
}
// return datamodel based on user
}
This works well, except in one respect: I can't access the promiseModule.currentContext in the models/facets in the domain folder.
My question is: how does promiseModule.currentContext even work? It's not accessed globally, but always via require, and I can't see how the currentContext gets set in the normal case, let alone why it isn't in mine.
Any help would be appreciated a lot!
Thanks.
Wouter