AppPot SDK for JavaScript, available for browsers and smart devices, or Node.js.
To use the SDK in the browser, add the following script tag to your HTML page
<script src="https://cdn.rawgit.com/NCDCHub/apppot-sdk-js/v2.3/dist/apppot.min.js"></script>
To use in the Node.js, use the npm package manager. Type the following into a terminal.
npm install apppot-sdk
As follows, configure the connection destination and apps information like following.
(url
, appId
, appKey
, appVersion
, companyId
and groupId
should be set a value corresponding to the environment.)
var window.AppPot = AppPotSDK.getService({
url: 'http://example.com/apppot/',
appId: 'apppot-test-app',
appKey: '1234567890abcdef1234567890abcdef',
appVersion: '1.0.0',
companyId: 1,
groupId: 1
});
Define models for your App.
window.Models = {
Customer: AppPot.defineModel('Customer', {
'name': {
type: AppPot.DataType.Varchar
},
'address': {
type: AppPot.DataType.Varchar,
length: 255
},
'age': {
type: AppPot.DataType.Long
},
'birthday': {
type: AppPot.DataType.DateTime
},
'isHuman': {
type: AppPot.DataType.Bool
}
}),
Item: AppPot.defineModel('Item', {
'name': {
type: AppPot.DataType.Varchar
},
'description': {
type: AppPot.DataType.Varchar
},
}),
...
};
Create DataBase for your App.
AppPot.createDatabase(Object.values(window.Models))
.then(()=>{
console.log('database is created!!');
});
You can find a documents at:
http://docs.apppot.jp/apppot/index.html
This SDK is distributed under the Apache License, Version 2.0