safeloaderjs
v1.0.4
Published
This safe loader is helps to handel the paths while using the require or import the modules from configaration.
Downloads
7
Maintainers
Readme
SafeloaderJS 👨💻
SafeloaderJS - Features
- SafeLoaderJS will help handle the relative path configaration.
- SafeLoaderJS also works in single instance.
Please report bugs there on Github.
Old method
const HomeController = require('../../HomeController');
// 😭 When we use it with this old method we have provide the relative path every time to load or import the files from other modules.
We have simplified this process by using the SaferLoaderJS.
Example
🌐 router.js
require('safeloaderjs'); // it's very important that we have to use it on top of our code.
let express = require('express');
let router = express.Router();
let HomeController = require('@Ctrl/HomeController.js');
router.get('/',HomeController);
module.exports = router;
.paths
configaration
@Ctrl = /Controllers/
SafeLoaderJS - v1.0
- If the path not provided it takes the default path.
- Even if you import this modules in multiple file it use the single instance.