javascript - how print modules on web -
var http = require('http'); function start() { function onrequest(req, res) { console.log("request received."); res.writehead(200, {'content-type': 'text/plain'}); res.end(); } http.createserver(onrequest).listen(8888); console.log("server has started."); } exports.start = start; var procfs = require('procfs-stats'); var ps = procfs(process.pid); function sysusage() { ps.io(function(err, io) { console.log('my process has done io', io); }); } exports.sysusage = sysusage;
here code, new in node.js how can print "procfs-stats" , "libcpuusage" on web?, not in console. thanks
you need template engine, there many (http://garann.github.io/template-chooser/), common ones are:
but it's choose preferred node application.
probably best option install , use expressjs framework in node.js app, gives powerful suite of features used in app. , of course, gives simple way add template engine too.
please refer specific needs: using template engines express
Comments
Post a Comment