In PHP we have:
echo '<a href="mycgi?foo=', urlencode($userinput), '">';
What is the NodeJs version of urlencode();
is that you need? urlendcode
in this case, maybe not related to nodejs, in client only use javacript function encodeURIComponent for encode
for example:
var apiUrl: string = 'mycgi?foo=';
apiUrl += encodeURIComponent(userInput)