JKHeadley / JKHeadley/rest-hapi

Support a collection in the modelPath config property

Open
#14 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
1.2k
Forks
155
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

Research direction

Start by tracing how config.modelPath is read and how model files are discovered; the issue does not name repository files or tests. Define completion as accepting the requested collection of model paths while preserving the existing single-directory behavior, then add or update coverage for both forms.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.