DEV Community

Anuj Pancholi
Anuj Pancholi

Posted on

1

Answer: How to pass variables in URL in NodeJS

One way to do it is using template literals, which has been discussed in other answers (I encourage you to check out the link shared by Jason).

const phone = "1234567890";
const message = "my-message-content";

const url = `http://www.techsolver.in/http-api.php?username=abc&password=pwd&senderid=MYID&route=1&number=${phone}&message=${message}`

console.log(url);

However, if…

Why node has a querystring module, to perform tasks that, at first glance, seem trivial.

Top comments (0)

SurveyJS custom survey software

JavaScript Form Builder UI Component

Generate dynamic JSON-driven forms directly in your JavaScript app (Angular, React, Vue.js, jQuery) with a fully customizable drag-and-drop form builder. Easily integrate with any backend system and retain full ownership over your data, with no user or form submission limits.

Learn more

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, valued within the supportive DEV Community. Coders of every background are welcome to join in and add to our collective wisdom.

A sincere "thank you" often brightens someone’s day. Share your gratitude in the comments below!

On DEV, the act of sharing knowledge eases our journey and fortifies our community ties. Found value in this? A quick thank you to the author can make a significant impact.

Okay