To make Baasic more accessible to a wider range of JavaScript frameworks and platforms, we have been working on a complete rewrite of the first JavaScript SDK version. As always, we would like to hear from you in order to make our SDKs even better, so download the release candidate version from GitHub or npm, and let us now your thoughts.
Architecture
JavaScript SDK was completely rewritten to smoothly overcome transition to new technologies and more maintainable SDK. It was built with the intention to be used inside any JavaScript based framework or platform. The library was written in TypeScript using Inversify dependency injection container, and everything is built using WebPack module bundler. Baasic modules are divided into classes called Clients, which use constructor injection to resolve endpoint routes. This allows developers to use dependency injection to override existing SDK functionality with ease. To use the SDK inside various frameworks and platforms, like AngularJS, Angular, React or Node.js, BaasicApp can be configured to use different StorageHandler, EventHandler, and HttpClient providers. Token storage and similar features are handled automatically by JavaScript SDK. Another important thing to mention is that every Baasic model can be easily extended - all you need to do is to add your properties and save the model using the Baasic Client.
What’s included in the RC version
- Core
- Default jQuery http provider
- Default local storage and browser events provider
- Modules
- Core communication
- Membership & Security
- Key Value & Value Set module
- Dynamic Resource module
- Article module
- Profile module
- Notification module
- Templating module
- Metering module
- Media Vault & Files module
Configuration
To start using Baasic JavaScript SDK, you need to create the BaasicApp with the following code:
//Note: this is configuration example only, these are the defaults
var options = {
apiRootUrl: 'api.baasic.com',
apiVersion: '<version>',
enableHALJSON: false
};
var application = new baasicSdkJavaScript.BaasicApp('<api-key>', options);
//To communicate with back-end modules use code similar to this
application.membershipModule.login.login({
username: '<username>',
password: '<password>'
}).then(function (data) {
//Do your work here
}, function (data) {
console.log(data);
});
To get more information about the configuration, please visit Baasic Developer Center or GitHub repository baasic-sdk-javascript.
Coming soon
We are going to release the AngularJS SDK (v1.x) side-by-side with JavaScript SDK, and Angular SDK (v2+) will be released soon after that. React and Node.js are next on our roadmap, so stay tuned.
Feel free to leave a comment
comments powered by Disqus