i wanna add html page route con , read temp in 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 in con"); } res.writehead(200, {'content-type': 'text/html'}); res.end(compiled({temp: temp})); }).listen(8080);
Comments
Post a Comment