尝试
var id=9;
client.get(`http://localhost:5000/api/produto/${id}`, function (data, response) {
console.log(data);
console.log("------------");
console.log(response);
});
它被称为模板文字:
来自https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals
Template literals are enclosed by the back-tick (` `) (grave accent) character instead of double or single quotes. Template literals can contain placeholders. These are indicated by the dollar sign and curly braces (${expression}). The expressions in the placeholders and the text between them get passed to a function. The default function just concatenates the parts into a single string. If there is an expression preceding the template literal (tag here), this is called a "tagged template". In that case, the tag expression (usually a function) gets called with the processed template literal, which you can then manipulate before outputting. To escape a back-tick in a template literal, put a backslash \ before the back-tick.