Examples - Sahil-Gulati/NOOPath GitHub Wiki

Example 1


const noopath = require("noopath");
noopath.setPath("/var/www/path/to/project");
noopath.setIgnoreExtensions(["json"]);

/**
 * Here `Connection` is the name of file.
 * Ex. noopath.load("Connection") will return something like this `/var/www/path/to/project/database/Connection.js`
 */
const context = require(noopath.load("Connection"));

const db = context.getInstance();
// ...
// ...
// ...