Categories
JavaScript Answers

How to URl encode strings in Node.js?

Spread the love

Sometimes, we want to URl encode strings in Node.js.

In this article, we’ll look at how to URl encode strings in Node.js.

How to URl encode strings in Node.js?

To URl encode strings in Node.js, we can call encodeURIComponent.

For instance, we write

encodeURIComponent('select * from table where uid = me()')

to call encodeURIComponent with return a string that is URI encoded.

Conclusion

To URl encode strings in Node.js, we can call encodeURIComponent.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *