Skip to content

Instantly share code, notes, and snippets.

@JWDT
Created January 8, 2019 13:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JWDT/c89fe6550e402c98182b1d3d7c36de7d to your computer and use it in GitHub Desktop.
Save JWDT/c89fe6550e402c98182b1d3d7c36de7d to your computer and use it in GitHub Desktop.
/**
* 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));
}
};
@SShourya
Copy link

Hii,
Actually i'm looking code in nodejs.
Or
can you please provide me code for API implementation in nodejs for integromat.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment