0
I have the following code:
var config = {
method: "post",
url:
"https://my-api-link/v2/[email protected]&token=EAD7FC0724EF4254FG34323D62FEF2",
headers: {}
};
I wanted to save the email and the token which are global variables,:
const email = proccess.env.EMAIL
const token = proccess.env.TOKEN
var config = {
method: "post",
url:
"https://my-api-link/v2/sessions?email=$email&token=$token",
headers: {}
};
I tried that other way:
const email = proccess.env.EMAIL
const token = proccess.env.TOKEN
var config = {
method: "post",
url:
"https://my-api-link/v2/sessions?email="+email"&token="+token"",
headers: {}
};
But also unsuccessfully,!
Thanks in advance!
The last
""
does not need and the variableemail
should be among+
being like this:"https://my-api-link/v2/sessions?email=" + email + "&token=" + token,
– Icaro Martins
Related: What is the correct way to concatenate strings in Javascript?
– Icaro Martins
Thank you very much!
– Guillerbr