【发布时间】:2021-08-20 22:56:11
【问题描述】:
我正在为用户构建一个带有预先确定答案的聊天机器人。一些答案需要文本,这些文本将是可点击的 URL/重定向。使用这个https://developer.mozilla.org/en-US/docs/Web/API/URL/URL 作为参考。
如何以较短的方式将 URL 从我的节点服务器传递到我的前端应用程序?例如。 “点击这里”
let url_one = new URL('https://www.google.co.uk/books/edition/Cotton_Candy/4smcwgEACAAJ?hl=en', 'Cotton Candy — Victoria Blakemore (2019)');
const Messages = [
{
message: `I couldn’t find what you’re looking for. Maybe try again but use vaguer search terms. This is also interesting by the way: ${url_one}`
},
]
module.exports = Messages;
【问题讨论】:
-
我没有收到你的问题。您想获得来自后端的答案吗?
-
这完全取决于前端应用程序期望接收数据的格式。如果您正在编写前端,那么它可以是您想要设计或重用的任何数据格式。否则,您需要阅读文档和/或与前端作者合作。
-
你只是问如何制作 HTML 链接?
标签: javascript node.js arrays variables url