複数のファイルでルーティングしたい
var routes=require('./routes');
ルート/index.jsで
exports.inicio=require('./inicio')
exports.home=require('./home')
inicio.jsで
exports.index=function(req,res){res.render('index/index',{title: 'Bienvenido a Inmoweb'});}
home.jsで
exports.nosotros=function(req, res){res.render('index/nosotros',{title:'Nosotros'});}
console.log(routes)のとき
{
inicio: {index:[function]},
home: {nosotros:[function]}
}
だから私はアプリを呼び出します
app.get('/',routes.inicio.index);
でもこう呼びたい
app.get('/',routes.index);
app.get('/nosotros',routes.nosotros);
そしてconsole.logはそうなると思われますか????
{
index:[function],
nosotros:[function]
}
どうやってするか???tnxすべて