0

What is the proper way of adding a new Module in Sailsjs? I understand I can just "npm install" a new module and "require" it in the pages I want to use it - but I believe there is a better way of doing that without having to repeatedly "require" the new module everywhere...

AleAssis
  • 376
  • 3
  • 7

1 Answers1

0

Well, this is the proper way of adding modules within your code. Your code becomes easier to maintain when you explicitly use require(), where you need it.

However, you can also make a module globally available. Check out this answer to find out how to do this and why you shouldn't be doing this.

Eddi
  • 782
  • 1
  • 7
  • 20