- Joined
- May 27, 2008
- Messages
- 3,628 (0.62/day)
System Name | Ultra 64 |
---|---|
Processor | NEC VR4300 (MIPS R4300i) |
Motherboard | proprietary design |
Cooling | Fanless aircooled |
Memory | 4.5MB 250 MHz RDRAM |
Video Card(s) | 62.5 MHz Reality Coprocessor |
Storage | 32 - 512 Mbit ROM Cartridge |
Display(s) | 720x576 |
Case | Clear Blue Funtastic |
Audio Device(s) | 16-bit CD quality |
Power Supply | proprietary design |
Mouse | N64 mouse for use with N64DD |
Keyboard | N64 keyboard for use with N64DD |
Im in the process of splitting my nodeJS 'app.js' file into separate modules for different functionality, Passport in a module, mongodb stuff, API stuff, SQLserver interaction etc.
Trouble is some of them require the same modules. So passport needs access to Mongo as well as some of the API stuff. Currently each module does its own require for the things it needs then in my app.js just the modules themselves are required and used for my routes.
The problem is this means im in the situation where I get duplicates of things like mongo required.
So my question what is best practice in this situation? The alternative I can think of is require any things that could be duplicated, like Mongo, in my app.js and pass that around. But im not a fan on having to pass things around to me the point of putting things into modules is to make it completely self contained and independent of the rest of the programme. Relying on dependencies seems to defeat that.
Trouble is some of them require the same modules. So passport needs access to Mongo as well as some of the API stuff. Currently each module does its own require for the things it needs then in my app.js just the modules themselves are required and used for my routes.
The problem is this means im in the situation where I get duplicates of things like mongo required.
So my question what is best practice in this situation? The alternative I can think of is require any things that could be duplicated, like Mongo, in my app.js and pass that around. But im not a fan on having to pass things around to me the point of putting things into modules is to make it completely self contained and independent of the rest of the programme. Relying on dependencies seems to defeat that.