This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function read(query, user, request) { | |
| var dispatch = { | |
| op1 : operation1, | |
| op2 : operation2, | |
| } | |
| if (request.parameters.operation && dispatch.hasOwnProperty(request.parameters.operation)) { | |
| dispatch[request.parameters.operation](query, user, request); | |
| return; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function read(query, user, request) { | |
| var queryComponents = query.getComponents(); | |
| /* | |
| { filters: null, | |
| selections: [], | |
| projection: null, | |
| ordering: {}, | |
| skip: null, | |
| take: 50, | |
| table: 'test', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function zumoJwt(expiryDate, aud, userId, masterKey) { | |
| var crypto = require('crypto'); | |
| function base64(input) { | |
| return new Buffer(input, 'utf8').toString('base64'); | |
| } | |
| function urlFriendly(b64) | |
| { | |
| return b64.replace(/\+/g, '-').replace(/\//g, '_').replace(/\=/g, ''); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // .NET C# | |
| var mobileServiceClient = new MobileServiceClient("<your-app-url>", "<your-app-key>"); | |
| mobileServiceClient.CurrentUser = new MobileServiceUser("Foo:123456789"); | |
| mobileServiceClient.CurrentUser.MobileServiceAuthenticationToken = "<your-users-JWT>"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var crypto = require('crypto'); | |
| var iterations = 1000; | |
| var bytes = 32; | |
| var aud = "Custom"; | |
| var masterKey = "<your-master-key>"; | |
| function insert(item, user, request) { | |
| var accounts = tables.getTable('accounts'); | |
| if (request.parameters.login) { | |
| // this is a login attempt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var azure = require('azure'); | |
| var qs = require('querystring'); | |
| function getSAS(accountName, accountKey, path, resourceType, sharedAccessPolicy) { | |
| return qs.encode(new azure.SharedAccessSignature(accountName, accountKey) | |
| .generateSignedQueryString(path, {}, resourceType, sharedAccessPolicy)); | |
| } | |
| function formatDate(date){ | |
| var raw = date.toJSON(); |
NewerOlder