rest-hapi icon indicating copy to clipboard operation
rest-hapi copied to clipboard

Support a collection in the modelPath config property

Open viktor1190 opened this issue 7 years ago • 0 comments

The configuration have a property to customize the models route:

config.modelPath = 'models';

This is a single path directory so all the models must be inside. It would be great if I could set up a collection of files instead of a single directory

For example, I have the next project tree:

myProject/
  |- index.js
  |- server.js
  |- config/
  |- modules/
      |- users_module/
          |- handlers/
          |- models/
              |- user.model.js
      |- article_module/
          |- handlers/
          |- models/
              |- article.model.js

And my config would be:

config.modelPath = ['modules/users_module/models/user.model', 'modules/article_module/models/article.model']';

This feature can be very useful to support a large projects with modular directory structure, like the above example.

viktor1190 avatar Apr 06 '17 21:04 viktor1190