Function
Static Public Summary | ||
public |
afterDelete(recordType: *, func: *, options: {}) |
|
public |
afterSave(recordType: *, func: *, options: {}) |
|
public |
beforeDelete(recordType: *, func: *, options: {}) |
|
public |
beforeSave(recordType: *, func: *, options: {}) |
|
public |
every(cron: *, func: *, options: {}) |
|
public |
fromJSON(attrs: *): * |
|
public |
You can configure the cloud code as an HTTP handler, which can respond to requests coming from outside the SDK. |
|
public |
hook(name: *, func: *, options: {}) |
|
public |
|
|
public |
op(name: *, func: *, options: {}) |
|
public |
toJSON(v: *): * |
Static Public
public afterDelete(recordType: *, func: *, options: {}) source
import {afterDelete} from 'skygear/lib/cloud/index.js'
Params:
Name | Type | Attribute | Description |
recordType | * | ||
func | * | ||
options | {} |
|
public afterSave(recordType: *, func: *, options: {}) source
import {afterSave} from 'skygear/lib/cloud/index.js'
Params:
Name | Type | Attribute | Description |
recordType | * | ||
func | * | ||
options | {} |
|
public beforeDelete(recordType: *, func: *, options: {}) source
import {beforeDelete} from 'skygear/lib/cloud/index.js'
Params:
Name | Type | Attribute | Description |
recordType | * | ||
func | * | ||
options | {} |
|
public beforeSave(recordType: *, func: *, options: {}) source
import {beforeSave} from 'skygear/lib/cloud/index.js'
Params:
Name | Type | Attribute | Description |
recordType | * | ||
func | * | ||
options | {} |
|
public every(cron: *, func: *, options: {}) source
import {every} from 'skygear/lib/cloud/index.js'
Params:
Name | Type | Attribute | Description |
cron | * | ||
func | * | ||
options | {} |
|
public fromJSON(attrs: *): * source
import {fromJSON} from 'skygear/lib/util.js'
Params:
Name | Type | Attribute | Description |
attrs | * |
Return:
* |
public handler(path: string, func: function(request: *): object, options: object) source
import {handler} from 'skygear/lib/cloud/index.js'
You can configure the cloud code as an HTTP handler, which can respond to
requests coming from outside the SDK. A custom HTTP endpoint can be
created using the handler
function.
A custom HTTP endpoint can be useful for the followings:
- receiving requests from outside the Skygear SDK
- allowing a third party webhook to call upon (e.g. payment service)
Example:
const skygearCloud = require('skygear/cloud');¬
skygearCloud.handler('handler1', function(req) {
// cloud code handling the request
return 'String';
}, {
method: ['GET', 'POST'],
userRequired: false
});
skygearCloud.handler('private', function(req) {
// cloud code handling the request
return {
status: 'ok'
};
}, {
method: ['GET', 'POST'],
userRequired: true
});
public hook(name: *, func: *, options: {}) source
import {hook} from 'skygear/lib/cloud/index.js'
Params:
Name | Type | Attribute | Description |
name | * | ||
func | * | ||
options | {} |
|
public isLocalStorageValid(): boolean source
import {isLocalStorageValid} from 'skygear/lib/util.js'
public op(name: *, func: *, options: {}) source
import {op} from 'skygear/lib/cloud/index.js'
Params:
Name | Type | Attribute | Description |
name | * | ||
func | * | ||
options | {} |
|
public toJSON(v: *): * source
import {toJSON} from 'skygear/lib/util.js'
Params:
Name | Type | Attribute | Description |
v | * |
Return:
* |