Express を使用して node.js で Web アプリを作成しています。次のようにルートを定義しました。
app.get("/firstService/:query", function(req,res){
//trivial example
var html = "<html><body></body></html>";
res.end(html)
});
エクスプレス内からそのルートを再利用するにはどうすればよいですか?
app.get("/secondService/:query", function(req,res){
var data = app.call("/firstService/"+query);
//do something with the data
res.end(data);
});
APIドキュメントには何も見つかりませんでした.「request」のような別のライブラリは使いたくないので、それは面倒です. アプリをできるだけモジュール化しようとしています。考え?
ありがとう