apiフォルダーからエラーをキャッチしたいと思います。azure-mobile-apps-nodeのエラーミドルウェア
はしかし、どのハンドラからトリガエラーがない限り明示エラー処理ミドルウェアキャッチは何もapp.get(someroute,handler)
この上の任意の提案をルーティング標準Expressを使用して宣言されていませんか?
ありがとうございます。
app.js
mobile.api.import('./api');
mobile.tables.initialize()
.then(function() {
app.use(mobile); // Register the Azure Mobile Apps middleware
app.listen(process.env.PORT || 3000); // Listen for requests
})
.then(function(){
if (process.env.NODE_ENV == 'production'){
///handle errors on prod
app.use(function(err, req, res, next) {
console.log('error catch - here');
res.statusCode = 500;
res.end();
});
}
});
API/testing.js
module.exports = {
"get": function (req, res, next) {
throw new Error('this is error');
}
};