I am trying to do the following:
var id=9;
client.get("http://localhost:5000/api/produto/{id}", function (data, response) {
console.log(data);
console.log("------------");
console.log(response);
});
but it says that :
{ id: [ 'The value \'{id}\'\' is not valid.' ] }
I want to know how can I use a local variable in the get request ? I am requesting to a project I've made and if I put a number instead of id it works.
try
It's called template literals:
from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals