@knetik/micro-knetikcloud
v3.1.10
Published
This package adds a customer scoped instance of the javascript knetikcloud sdk to [micro-core](https://www.npmjs.com/package/@knetik/micro-core) the multi tenant framework.
Downloads
165
Readme
Knetik Micro KnetikCloud
This package adds a customer scoped instance of the javascript knetikcloud sdk to micro-core the multi tenant framework.
When a customer connects to a micro-core application, the required app_id and optional access token are passed into the knetikcloud sdk. Creating an sdk instance scoped to this this customer.
In micro-console
App.connect(app_id, access_token)
.then(App => App.KnetikCloud.get('ContentArticlesApi'))
.then(api => api.getArticles())
.then(res => console.log(res))
.catch(err => console.log(err))
In a micro-core
module
module.exports (App) => {
App.KnetikCloud.get('ContentArticlesApi')
}
In a micro-core
express route
Server.get('/articles', (req, res) => {
const api = req.App.Knetikcloud.get('ContentArticlesApi');
api.getArticles(req.query)
.then(result => res.json({ resp: result }))
.catch(err => res.status(422).json({ err }));
});