You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for boilerplate. It's very helpful.
It's my first real project with express and mongoose, and I'm sorry if my question is stupid.
I'm working on dictionary, and have an Article model:
I need new route /search/:text
This route not related to /article route, but method still related to article model: Article.find({ wordForms: text })
I'm a little confused, where to place this code.
Can you give me an advice please?
The text was updated successfully, but these errors were encountered:
Hi @Aparus by any chance your project is open sources so I can take a look?
I need a bit more context to help you out. If that route is not related to articles, what is related to? Maybe is related to another model? If it's related to another model and the route is there, it is totally ok to use the Article model reference from some other model.
I hope this helps and sorry if the answer is a bit vague.
For now my whole project is just your basic boilerplate, I swear there is nothing to share. :)
I just little changed Article model, as I wrote above, from { title, body } to { wordTable, wordForms }. I just meant, that desired route is not part of link domain.com/article/, but completely different link domain.com/search/:text. And I can't write this route into /model/article/router.js, and there is no other than Article model for write it. Where is better place to write this route?
But this route should run method on the Article model, and find text in array field, and there will be other methods in the future, related only to Article model. All existing by default methods are written in lib/controller.js and lib/facade.js. And now I need unique method only for Article model, not shared with other models. I guess I should write it in model/article/controller.js and model/article/facade.js. Should I? Where to write not universal method, but especial method for one particular model? How to expand model?
Please, provide with couple examples, how to write unique method for only one model. And where to place strange routes :-)
I apologize for my ignorance, I worked last year with firebase and material-ui, and forget many of things I had learned before about express-mongoose stack.
Thanks for boilerplate. It's very helpful.
It's my first real project with express and mongoose, and I'm sorry if my question is stupid.
I'm working on dictionary, and have an Article model:
I need new route
/search/:text
This route not related to /article route, but method still related to article model:
Article.find({ wordForms: text })
I'm a little confused, where to place this code.
Can you give me an advice please?
The text was updated successfully, but these errors were encountered: