Skip to content

Question: where to place additional code for model, with different route?  #148

@ApayRus

Description

@ApayRus

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:

const articleSchema = new Schema({
  wordTable: { type: String, required: true },
  wordForms: { type: [String] }
})

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions