我敢肯定,我可以執行一個腳本或函數每次執行一個請求(app.get或app.post)res和req var但我不能'查找如何exec每個請求上的腳本node.js
可以請你幫我
感謝
編輯:
我嘗試
var express = require('express')
, http = require('http')
, path = require('path');
var app = express();
app.use(function(err, req, res, next){
console.log('aa');
next();
});
在
我app.js但我從來沒有在機管局我的控制檯
我app.get在控制器:
files = fs.readdirSync(__dirname + '/controllers');
files.forEach(function(file){
var name = file.replace('.js', '');
require('./controllers/' + name)(app, models);
});
如果我刪除此代碼app.add的作品,但我不能使用app.get
嘗試從您的中間件功能刪除參數'err'。 – Tiago