'How i can validate the following function in Nodejs, express (REST API)
How i can apply validation on the following field (MobileNumber) to check it weather it present in Database or not (Nodejs, Express ) REST API
async function getUserByMobileNumber(MobileNumber) {
try {
let pool = await sql.connect(config);
let product = await pool.request()
.input('input_parameter', sql.VarChar, MobileNumber)
.query("SELECT * from Users where Mobile = @input_parameter");
return product.recordsets;
}
catch (error) {
console.log("Error found !! ", 404);
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
