to check in Node if module exists and if exists to load, we add a try-catch block.
For instance, we write
try {
const m = require("/home/test_node_project/per");
} catch (ex) {
handleErr(ex);
}
to call require
to require the /home/test_node_project/per module.
If the module can’t be included, then the catch block runs.