apppot-sdk

2.3.35 • Public • Published

AppPot SDK for JavaScript

NPM

npm version

AppPot SDK for JavaScript, available for browsers and smart devices, or Node.js.

How to Use

install

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

configure

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

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

Create DataBase for your App.

AppPot.createDatabase(Object.values(window.Models))
  .then(()=>{
    console.log('database is created!!');
  });

Other API or usage

You can find a documents at:
http://docs.apppot.jp/apppot/index.html

License

This SDK is distributed under the Apache License, Version 2.0

Readme

Keywords

none

Package Sidebar

Install

npm i apppot-sdk

Weekly Downloads

2

Version

2.3.35

License

Apache-2.0

Unpacked Size

1.22 MB

Total Files

42

Last publish

Collaborators

  • ncdc