0
我想從應用程序(var app = express();)變量發送一些數據到一些代碼與Socket.IO相關,並向一些中間件類型發送一個值類似的方式:快遞js發送應用程序變量到路線
function routes(app) {
app.post('/evento', function (req, res) {
evento.novoEvento(req, res, app);//passing app to the method evento.novoEvento
});
app.put('/evento', function (req, res) {
restringeAcao(req, res, 'Evento');//passing the string 'Evento' to the method evento.alteraEvento
}, evento.alteraEvento);
});
}
它確實有效,但我從來沒有見過這樣的例子。我的問題是:沒有人有這樣的理由嗎?如果是的話,什麼是正確的做法呢?
謝謝,我現在使用res.app就好了。 – desoares 2014-10-29 17:31:35
@desoares請接受此答案,然後讓其他人可以看到問題已被回答。謝謝。 – 2014-10-30 08:53:31