fdj815
fdj815

Reputation: 569

Node.js: Where To Place Internal Modules In Folder Structure?

The Situation

I often see Node.js applications with the following structure:

Common pattern:

My Problem

What I don't like about this pattern:

My Idea

So I think it would be a good idea also to place internal modules in an node_modules folder (somewhere in the project). So node would be able to find them, even if you don't explicitly specify the path.

For example:

My Question

  1. Are there any cons about my plan?
  2. Is there another idea where to place internal modules in folder structure?

Thanks for your answer (or comment). - If anything is unclear, please comment.

Upvotes: 6

Views: 4033

Answers (1)

goofballLogic
goofballLogic

Reputation: 40479

Perhaps you could use npm link to pull your modules into node_modules? See: https://docs.npmjs.com/cli/link

Upvotes: 4

Related Questions