//myfirstmodule.js
exports.myDateTime = function () {
return Date();
};
//0217.js
var http = require('http');
var date = require('./myfirstmodule');
http.createServer(function (req, res) {
res.writeHead(200, {
'Content-Type': 'text/html; charset=utf-8',
});
res.write(date.myDateTime());
res.end();
}).listen(8080);
沒有留言:
張貼留言