I have a /custom_modules/db.js
and am trying to require
it from /routes/users.js
but am unsure of how to do so.
You use ./
to signify local directory that you are in, and ../
to go back a directory. Therefore:
require('./../custom_modules/db');
Should just use ../
Example :
var db = require('../custom_modules/db.js');
Just insert a leading /
to give an absolute path:
require('/custom_modules/db.jpg');
The rules for resolving modules path are detailed in the modules documentation.