from the code snippet you shared it seems like it can be done with basic solution.
for example:
var baseUrl = 'http://api.open-notify.org/iss-now.json'
var fullUrl = `json-csv.com/?u=${baseUrl}`
console.log(fullUrl) //===> json-csv.com/?u=http://api.open-notify.org/iss-now.json
let me know if this is the link you would like to have: json-csv.com/?u=http://api.open-notify.org/iss-now.json
the base URL you can get from the request if it should be dynamic.
this can be a solution for you
server
app.get('/somepath', ()=>{
var baseUrl = 'http://api.open-notify.org/iss-now.json'
var fullUrl = `json-csv.com/?u=${baseUrl}`
res.status(200).json({url: fullUrl})
})
client
fetch('/somepath')
.then((response) => {
return response.json();
})
.then((res) => {
window.open(
res.url,
'_blank'
);
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…