kinvey-backend-sdk
Advanced tools
Comparing version 0.1.1 to 0.1.2
## Changelog | ||
### 0.1.2 | ||
* Updated bson library to v0.4.15 | ||
### 0.1.1 | ||
@@ -4,0 +7,0 @@ * Updated contributors |
{ | ||
"name": "kinvey-backend-sdk", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Backend SDK", | ||
@@ -16,3 +16,3 @@ "engines": { | ||
"moment": "2.10.6", | ||
"bson":"0.4.11", | ||
"bson":"0.4.15", | ||
"kinvey-code-task-runner": "0.1.1" | ||
@@ -19,0 +19,0 @@ }, |
@@ -21,2 +21,10 @@ # Kinvey Backend SDK (beta) | ||
You then must initialize the sdk to retrieve a reference to the backend service: | ||
``` | ||
var service = sdk.service(function(err, service) { | ||
// code goes here | ||
}; | ||
``` | ||
## DataLink framework | ||
@@ -149,43 +157,44 @@ | ||
The following is an examp | ||
The following is an example | ||
``` | ||
var sdk = require('kinvey-backend-sdk'); | ||
var dataLink = sdk.dataLink; // gets the datalink object from the SDK | ||
var service = sdk.service(function(err, service) { | ||
var dataLink = service.dataLink; // gets the datalink object from the service | ||
var notImplementedHandler = function(request, complete) { | ||
complete("These methods are not implemented").notImplemented().done(); | ||
}; | ||
var notImplementedHandler = function(request, complete) { | ||
complete("These methods are not implemented").notImplemented().done(); | ||
}; | ||
var getRecordById = function(request, complete) { | ||
var entityId = request.entityId; | ||
var entity; | ||
var getRecordById = function(request, complete) { | ||
var entityId = request.entityId; | ||
var entity; | ||
// Do some logic to get the entity id from the remote data store | ||
// Assume that data is retrieved and stored in "entity" variable | ||
// Do some logic to get the entity id from the remote data store | ||
// Assume that data is retrieved and stored in "entity" variable | ||
// After entity is retrieved, check to see if it exists | ||
if (typeof entity === 'undefined' or entity === null or entity = {}) { | ||
return complete("The entity could not be found").notFound().next(); | ||
} else { | ||
// return the entity | ||
return complete(entity).ok().next(); | ||
// After entity is retrieved, check to see if it exists | ||
if (typeof entity === 'undefined' || entity === null || entity === {}) { | ||
return complete("The entity could not be found").notFound().next(); | ||
} else { | ||
// return the entity | ||
return complete(entity).ok().next(); | ||
} | ||
} | ||
} | ||
// set the collection | ||
var widgets = dataLink.collection('widgets'); | ||
// set the collection | ||
var widgets = dataLink.collection('widgets'); | ||
// wire up the event that we want to process | ||
widgets.onGetById(getRecordById); | ||
// wire up the event that we want to process | ||
widgets.onGetById(getRecordById); | ||
// wire up the events that we are not implementing | ||
widgets.onGetByQuery(notImplementedHandler); | ||
widgets.onGetAll(notImplementedHandler); | ||
widgets.onGetCount(notImplementedHandler); | ||
widgets.onInsert(notImplementedHandler); | ||
widgets.onUpdate(notImplementedHandler); | ||
widgets.onDeleteAll(notImplementedHandler); | ||
widgets.onDeleteByQuery(notImplementedHandler); | ||
widgets.onDeleteById(notImplementedHandler); | ||
// wire up the events that we are not implementing | ||
widgets.onGetByQuery(notImplementedHandler); | ||
widgets.onGetAll(notImplementedHandler); | ||
widgets.onGetCount(notImplementedHandler); | ||
widgets.onInsert(notImplementedHandler); | ||
widgets.onUpdate(notImplementedHandler); | ||
widgets.onDeleteAll(notImplementedHandler); | ||
widgets.onDeleteByQuery(notImplementedHandler); | ||
widgets.onDeleteById(notImplementedHandler); | ||
}; | ||
``` | ||
@@ -192,0 +201,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
197808
207
+ Addedbson@0.4.15(transitive)
Updatedbson@0.4.15