Does Google Drive API provide a way to execute my code on the Google Drive server infra?
Let's say I want to write Google Dirve based grep
to let customer search through thier files.
I want to be able to write something like this: (very simplified to make it short)
/* define the function for grep */
var grep = function(params, callback) {
// 1) find all text files using `gapi.client.drive.files.list`
// 2) open each file with `gapi.client.drive.files.get`
// 3) scan for the serach string occurance
callback(search_result);
}
/* register the code on the server with imaginary API */
gapi.client.drive.server.register('myapp.grep', grep);
/* execute from Browser */
gapi.client.drive.server.myapp.grep({searchString: 'Abrakadabra', mimeType: 'application/javascript'},
function(resutls) {
console.log(results)
}
);
There are tons of application types can take advantage of this approach. Simple DB manager is another example.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…