Created
January 8, 2019 13:54
-
-
Save JWDT/c89fe6550e402c98182b1d3d7c36de7d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Responds to any HTTP request. | |
* | |
* @param {!express:Request} req HTTP request context. | |
* @param {!express:Response} res HTTP response context. | |
*/ | |
exports.find_and_replace = (req, res) => { | |
let old_string = req.query.old_string || null; | |
let text_to_find = req.query.text_to_find || null; | |
let text_to_replace = req.query.text_to_replace || null; | |
if ((old_string == null) || (text_to_find == null) || (text_to_replace == null)) { | |
// If any of the fields are empty, return error 400 | |
// This means there's something wrong with the input. | |
res.status(400).send(''); | |
} | |
else { | |
res.status(200).send(old_string.replace(text_to_find, text_to_replace)); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hii,
Actually i'm looking code in nodejs.
Or
can you please provide me code for API implementation in nodejs for integromat.