In my express.js application i am organizing my routes in following way
routes/comment.js(handle all the comment routes)
var express = require('express');
var router = express.Router();
var comment = require('../controller/comment');
router.route('/new').get(comment.create);
module.exports = router;
routes/post.js(handle all the post routes)
var express = require('express');
var router = express.Router();
var post = require('../controller/post');
router.route('/new').get(post.create);
module.exports = router;
And i am including in app.js file like this way
//need to include these declarations into another file and include that file here
//eg: require('config/main-routes');
/*
routes like comment/new
*/
var comment = require('./routes/comment');
app.use('/comment',comment);
/*
routes like post/new
*/
var post = require('./routes/post');
app.use('/post',post)
This works fine however i want to include this into another file lets say config/route-main.js
and link this to app.js
file
How can i do that??