-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HMVC #28
Comments
That sounds like a fine idea; because Trails doesn't dynamically app = {
api: {
controllers: { ... },
models: { ... },
services: { ... }
},
config: { ... }
} In practice, we want to encourage a particular convention. The current design is how Rails and Grails organize their directories, so users coming from those frameworks (or others that are inspired by them, like Sails) are familiar already with where things are. I see two ways to do this.1. you can manually setup the require's to load stuff like this. e.g.// api/index.js
exports.controllers = {
UserController: require('./User/UserController'),
CommentController: require('./Comment/CommentController'),
// etc...
}
exports.models = {
User: require('./User/UserModel')
// etc ...
} You'd probably want to create a modified generator to do this automatically. 2. you could write your own trailpack to translate the object all at once. |
Brilliant, I hadn't even noticed the index.js files, that makes things much easier. Cool, I'm going to have a play around, make a fork of the example, and get that working, and then I'll probably look at getting some yo scripts for it as well. Would there be any interest in these for anyone in the future wanting to do this? |
@YaManicKill awesome, let me know what you come up with. Yea, I'd be open to merging in a |
I think this work can fall entirely under the purview of generator-trails, so @YaManicKill open an issue over there and we can continue discussion there. sound good? |
Alrighty, created trailsjs/generator-trails#12. Closing this. |
I was wondering if you guys would be open to supporting an HMVC setup with trails? It's something that I've found has improved my development massively, and currently I'm doing it with my front-end code, but as I'm using sails, I can't use it with my backend code. It would be great if we could get this.
For those unaware, currently the backend is defined like this:
HMVC is where you could organise it more like this:
And it means that everything you need for a particular feature is in the folder together.
Ideally, we would also be able to add the routes as individual files into these folders as well, that would be brilliant. I really hope you look to doing this, as it would mean that there was a massive reason for me to use Trails (as I've not found a good node framework that uses hmvc yet).
The text was updated successfully, but these errors were encountered: