💡 Moved to cuba-platform/frontend/packages/cuba-rest-js
JavaScript library for web and Node.js which facilitates CUBA Platfotm's REST API usage.
npm install @cuba-platform/rest --save
Import as module
const cuba = require('@cuba-platform/rest');
Or using ES6 imports:
import * as cuba from '@cuba-platform/rest';
bower install cuba-platform/cuba-rest-js
<script src="./bower_components/cuba-rest-js/dist-browser/cuba.js">
Library has no external dependencies. It's assumed that Promise
and fetch
-compatible API are available
or polyfilled i.e. in node environment:
npm install node-fetch --save
global.fetch = require('node-fetch');
import * as cuba from 'cuba-rest-js';
const app = cuba.initializeApp({
name: 'myApp',
apiUrl: 'http://localhost:8080/app/rest/'
});
app.getUserInfo().then((d) => {
console.log(d);
});
// retrieve app by name
const myApp = cuba.getApp('myApp');
or use if you want to manage instances yourself
const myApp = new CubaApp("myApp", "http://localhost:8080/app/rest/")
myApp.loadEntities('sec$User', {view: '_minimal', sort: 'login'}).then((users) => {
console.log(users);
});
In order to run integration tests you need Java to be installed.
npm run test:integration
Start test CUBA app
npm run start-test-app
Run tests
npm test
Stop test app
npm run teardown-test-app
npm run dist
npm run lint
npm run generate-docs