【发布时间】:2013-12-23 02:58:25
【问题描述】:
如何在 html 中显示服务器端 node.js 的变量中保存的文本。
换句话说,为了更加清楚,我已经从访问 twitter (Twitt) 的 api 中提取了输出,并且我试图在页面底部显示该文本。
这就是网页的调用方式
app.get('/', function (req, res) {
res.sendfile('./Homepage.html');
});
这是调用 Node.js 文件的地方:
var express = require('express');
var app = express();
这是变量所在的位置:
T.get('search/tweets', { q: hash1 + ' since:2013-11-11', count: 5 },
function(err, reply) {
response = (reply),
console.log(response)
app.append(response)
})
【问题讨论】:
-
我不明白你打电话给
T的确切位置。您将需要在您的快速路由中调用它,以便能够将其输出与您的响应一起发送。
标签: javascript html node.js express