Skip to content

ncdcdev/apppot-sdk-js

Folders and files

NameName
Last commit message
Last commit date
Nov 26, 2021
Nov 17, 2020
Nov 26, 2021
Oct 30, 2020
Nov 14, 2017
Oct 30, 2020
Mar 18, 2017
Sep 6, 2017
Nov 17, 2020
Nov 17, 2020
Oct 30, 2020
Nov 26, 2021
Oct 4, 2016
Oct 30, 2020
Nov 17, 2020
Oct 4, 2016
Nov 17, 2020
Nov 17, 2020

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4