postman-code-generators
postman-code-generators copied to clipboard
Add support for QCObjects serviceLoader that is OOP oriented
Is your feature request related to a problem? Please describe. It is needed an OOP oriented client in JavaScript to call microservices in the front-end side as well as the backend without the need to refactor the code.
Describe the solution you'd like QCObjects is supporting that by the use of a serviceLoader helper that is wrapping the caller in the front-end as well as the backend using the same code pattern.
Additional context Below is a code example that is working in the browsers as well as in node environment:
Class('MyTestService',Service,{
name:'myservice',
external:true,
cached:false,
method:'GET',
headers:{'Content-Type':'application/json'},
url:'https://api.github.com/orgs/QuickCorp/repos',
withCredentials:false,
_new_:()=>{
// service instantiated
},
done:()=>{
// service loaded
}
});
// creating the OOP service client instance and loading it with serviceLoader at once
var service = serviceLoader(New(MyTestService,{
data:{param1:1}
})).then(
(successfulResponse)=>{
// This will show the service response as a plain text
console.log(successfulResponse.service.template);
},
(failedResponse)=>{
});
QCObjects is being used by thousands of companies around the world since a few months ago (see npm stats ) and has been featured by British Herald as today, the most advanced framework for modern software development