Reusable JS Routines called from ProfoundAPI
Posted: Mon Feb 21, 2022 4:26 pm
As the first step of my Profound API I want to write a custom node step to run reusable routines...
In the same folder I have the validators.js file...
Is this possible? I am getting errors running the tester about module not being found:
Code: Select all
function runValidations(request, response)
{
var validator = require(validators.js");
if (!validator.customerIsValid(request)) {
//set failure variable
} else {
//set success variable
}
}
Code: Select all
function customerIsValid(request)
{
// reusable routine to do the actual validation
}
export default customerIsValid;
Code: Select all
{
"error": {
"code": "MODULE_NOT_FOUND",
"requireStack": [
"c:\\Projects\\TestProjects\\ProfoundJS\\modules\\valTests\\...
],
"message": "Cannot find module 'validators.js' Require stack: -