这是怎么回事 ?
我正在用express.js开发一个网站,我想知道如何将JavaScript中的变量从ejs文件导出到js文件?
ejs文件:
let channelText = guild.channels.cache.filter(channel => channel.type == ext);
channelText.forEach((channel)=>{
%>
#
我想将strUser变量导出到我的js文件夹中。
我的js文件:
// Settings endpoint.
app.post("/dashboard/:guildID", checkAuth, async (req, res) => {
// We validate the request, check if guild exists, member is in guild and if member has minimum permissions, if not, we redirect it back.
const guild = client.guilds.cache.get(req.params.guildID);
if (!guild) return res.redirect("/dashboard");
const member = guild.members.cache.get(req.user.id);
if (!member) return res.redirect("/dashboard");