【发布时间】:2016-01-08 18:43:56
【问题描述】:
我正在使用带有 javascript 后端的 azure 移动服务,使用 rest API。 Azure 告诉我从移动服务迁移到最新的应用服务。我从官方 azure 博客中阅读了这些更新,这些更新说明了 rest api 功能的一些重大变化:
https://azure.microsoft.com/en-us/blog/azure-mobile-apps-november-2015-update/
问题是我在新文档中没有找到如何从 Javascript App Services 中的脚本访问表。
在移动服务中,如果您想访问表的 crud,请执行以下操作:
exports.post = function(request, response) {
// Use "request.service" to access features of your mobile service, e.g.:
// var tables = request.service.tables;
//accesing sample table
var sampleTable = request.service.tables.getTable('sample');
// then you can do an insert, update, delete and select through sampleTable ...
...
}
在应用服务中你有类似的东西:
module.exports = {
"post": function (req, res, next) {
//there is no req.service.tables.getTable('TABLE_NAME');
...
}
所以我的问题是应用服务中的方法 tables.getTable() 在哪里以及如何访问它。官方文档中还有Mobile Services的对象定义,可以通过request.service.tables.getTable('TABLE_NAME')获取。
https://msdn.microsoft.com/en-us/library/azure/jj554218.aspx
微软还没有更新它的文档吗?
【问题讨论】:
标签: javascript azure backend