Home Reference Source

Skygear SDK for JS

npm npm Build Status License

Skygear Server is an opensource serverless backend for making web and mobile app development faster, delegate the backend to Skygear so you can focus at the frontend.

You may try the host version at skygear.io or deploy your own server.

This repo contains the Skygear JS Client SDK (skygear), and skygear-node which enable you to write custom Cloud Functions to extend Skygear capability.

Check out the Quick Start Guide to start using Skygear JS SDK to write your Web / Ionic / React-Native apps.

Besides guides, here is the API doc.

Installation with npm

Simply install via

$ npm install skygear

And you can start configure Skygear in your app:

var skygear = require('skygear');
#import skygear from 'skygear'; #For ES2015

skygear.config({
    'endPoint': 'https://<your-app-name>.skygeario.com',
    'apiKey': '<your-api-key>',
}).then(() => {
    console.log('Container is ready to make API call');
}, (error) => {
    console.log(error);
});

Installation via CDN

Include the following lines into the header of your HTML file:

<!--Skygear CDN-->
<script src="https://code.skygear.io/js/polyfill/latest/polyfill.min.js"></script>
<script src="https://code.skygear.io/js/skygear/latest/skygear.min.js"></script>

<!--Skygear configuration-->
<!--The app end point and the api key can be found in the developer portal-->
<script>
  skygear.config({
    'endPoint': 'https://<your-app-name>.skygeario.com/', // trailing slash is required
    'apiKey': '<your-api-key>',
  }).then(() => {
    console.log('skygear container is now ready for making API calls.');
  }, (error) => {
    console.error(error);
  });
</script>

Running client example

Checkout the source and run the following to launch a local server:

npm install

# run example with demo endpoint
npm run example

# run example with your app endpoint
SKYGEAR_ENDPOINT=https://<your-app-name>.skygeario.com SKYGEAR_API_KEY=<your-api-key> npm run example

Development

Check out [DEVELOPMENT.md].

Pull requests are welcomed!

Report bug on https://github.com/SkygearIO/skygear-SDK-JS/issues

Support

For implementation related questions or technical support, please find us on the official forum or community chat.