How do I URl encode something in Node.js?

TIMEX picture TIMEX · Jul 2, 2011 · Viewed 303.5k times · Source

I want to URL encode this:

SELECT name FROM user WHERE uid = me() 

Do I have to download a module for this? I already have the request module.

Answer

Joe picture Joe · Jul 2, 2011

You can use JavaScript's encodeURIComponent:

encodeURIComponent('select * from table where i()')