得不到Request.azureMobile
Can not get Request.azureMobile
我正在尝试使用 Node.js 后端构建移动应用服务 API
这是我从 Microsoft 文档中实现但无法正常工作的代码。
这是我的 app.js
var express = require('express'),
azureMobileApps = require('azure-mobile-apps');
var app = express();
var loginApi = require('./api/login');
var mobile = azureMobileApps();
var mobileApp = azureMobileApps({
// Explicitly enable the Azure Mobile Apps home page
homePage: true,
// Explicitly enable swagger support. UI support is enabled by
// installing the swagger-ui npm module.
swagger: true
});
mobileApp.tables.import('./tables');
mobileApp.api.import('./api');
app.use('/login', loginApi(mobile.configuration));
mobileApp.tables.initialize()
.then(function () {
app.use(mobileApp);
app.listen(process.env.PORT || 3000);
});
这是我的登录信息api
var express = require('express'),
bodyParser = require('body-parser');
module.exports = function (configuration) {
var router = express.Router();
router.get('/',(req, res, next) => {
console.log(req.azureMobile);
});
return router;
};
错误是req.azureMobile未定义
我不知道如何让它工作,我只是尝试通过浏览器进行测试,只需插入 url get 方法
我已经解决了这个问题,我需要在 Easy api
中添加 api
我正在尝试使用 Node.js 后端构建移动应用服务 API 这是我从 Microsoft 文档中实现但无法正常工作的代码。 这是我的 app.js
var express = require('express'),
azureMobileApps = require('azure-mobile-apps');
var app = express();
var loginApi = require('./api/login');
var mobile = azureMobileApps();
var mobileApp = azureMobileApps({
// Explicitly enable the Azure Mobile Apps home page
homePage: true,
// Explicitly enable swagger support. UI support is enabled by
// installing the swagger-ui npm module.
swagger: true
});
mobileApp.tables.import('./tables');
mobileApp.api.import('./api');
app.use('/login', loginApi(mobile.configuration));
mobileApp.tables.initialize()
.then(function () {
app.use(mobileApp);
app.listen(process.env.PORT || 3000);
});
这是我的登录信息api
var express = require('express'),
bodyParser = require('body-parser');
module.exports = function (configuration) {
var router = express.Router();
router.get('/',(req, res, next) => {
console.log(req.azureMobile);
});
return router;
};
错误是req.azureMobile未定义 我不知道如何让它工作,我只是尝试通过浏览器进行测试,只需插入 url get 方法
我已经解决了这个问题,我需要在 Easy api
中添加 api