2013-11-23 3 views
0

Express는 하위 앱에 절대 경로가 정의되어 있어야합니다. otherApp'/'을 사용하여 모든 자료를 일치시킬 수는 없습니다. app 경로입니다.하위 앱에 투명한 경로를 사용할 수 있습니까?

var app = express(); 
var otherApp = express(); 

app.get('/', function (req, res) { 
    res.send('HELLO!'); 
}); 

//this works 
otherApp.get('/other', function (req, res) { 
    res.send(req.path); 
}); 

//this doesn't 
otherApp.get('/', function (req, res) { 
    res.send(req.path); 
}); 

app.get('/other*', otherApp); 

경로를 otherApp로 변경하려면 하위 응용 프로그램에서도 경로를 변경해야합니다.

모든 하위 응용 프로그램에 대해이 투명성/상대적을 정의하는 방법이 있습니까?

답변

1

시도 app.use('/other/', otherApp);. use이고 get이 아니라는 점에 유의하십시오.

관련 문제