Subscribe / Unsubscribe Enewsletters | Login | Register

Pencil Banner

Kinvey boosts enterprise mobile apps

Martin Heller | Sept. 11, 2014
An MBaaS (mobile back end as a service) such as FeedHenry, Kinvey, or Parse is a kind of PaaS (platform as a service) for server-backed mobile applications. Kinvey bills itself as a complete mobile and Web app platform. It has extensive client support, integrates with the major enterprise databases, and offers a back-end data store, a file store, push notifications, mobile analytics, iBeacon support, and the ability to run custom code on the back end.

Cloud code

Kinvey cloud code is written in JavaScript. In addition to using standard JavaScript and external services, it can use Kinvey APIs for logging, collection access, sending push notifications, sending email, validating requests, date and time functions, doing asynchronous processing, rendering a Mustache template, and obtaining the back-end context. Cloud code can live in hook processing functions and custom endpoints. Cloud code is versioned internally in Kinvey.

As a simple example, the following custom cloud endpoint handler responds to any request by asking for the real-time information feed for the Boston MBTA Red Line subway, parsing the JSON response, and sending that JSON to your client.

function onRequest(request,response,modules){

var req = modules.request;

req.get('http://developer.mbta.com/Data/Red.json', function(error, resp, body){

if (error){

response.body = {error: error.message};

response.complete(400);

return;

}

response.body = JSON.parse(body);

response.complete(resp.status);

});

}

Scheduled code can run against your custom endpoints. Scheduled code is commonly used to aggregate, archive, and clean up data; to pull data from a third-party API into Kinvey; or to send out a batch of emails or push notifications.

Kinvey has flexible, hook-based, back-end business logic. The hook-processing pipeline runs as follows:

Request from the client to the Kinvey back end

Authentication of the client (verify that client has access to this back end)

Pre-processing hooks

Database actions

Post-processing hooks

Clean-up and response formatting

Response returned to the requesting client

Kinvey has six hook-processing functions that you can implement:

Function (hook) When called

onPreFetch(request, response, modules) (Step 3) Called before a query or load (HTTP verb GET)

onPreSave(request, response, modules) (Step 3) Called before a save or update (HTTP verb POST or PUT)

onPreDelete(request, response, modules) (Step 3) Called before a delete (HTTP verb DELETE)

onPostFetch(request, response, modules) (Step 5) Called after a query or load (HTTP verb GET)

onPostSave(request, response, modules) Step 5) Called after a save or update (HTTP verb POST or PUT)

onPostDelete(request, response, modules) (Step 5) Called after a delete (HTTP verb DELETE)

Kinvey only guarantees that the preprocessing hooks will be called, as an error in the database actions will cause the postprocessing hooks to be skipped.

Cloud database, data links, and integrations

Kinvey implements a simple JSON key-value data store with entities and collections, using MongoDB. In the business and enterprise versions, Kinvey also has data links for Oracle, SQL Server, Salesforce, and Microsoft Dynamics CRM, plus a generic connector. The data link architecture is defined as a REST API.

Data links connect a MongoDB collection specifically marked for data integration with your database, and forward CRUD (create, read, update, and delete) requests to the database. (A few customers have used a data integration collection to cache the data for performance reasons, but mostly the data integration collection does not hold onto the data.)

 

Previous Page  1  2  3  4  Next Page 

Sign up for CIO Asia eNewsletters.