node.js require all files in a folder?

How do I require all files in a folder in node.js?

need something like:

files.forEach(function (v,k){
  // require routes
  require('./routes/'+v);
}};

15 Answers
15

Leave a Comment