我想添加另一个html页面,我可以路由到con并读取temp,就像我在index.html中一样
var http = require('http');
var ejs = require('ejs');
var fs = require('fs');
var system = require('child_process').exec;
var content = fs.readFileSync('index.html', 'utf-8');
var compiled = ejs.compile(content);
http.createServer(function(req,res) {
var temp = 5;
if(req.url === "/con") {
console.log("You are in con");
}
res.writeHead(200, {'Content-Type': 'text/html'});
res.end(compiled({temp: temp}));
}).listen(8080);