Welcome aboard! We are happy you are here and wish you good net-raft!
var http = require('http')
const os=require('os');
var srv = http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
var buf = Buffer.from(os.platform());
if (buf.indexOf('win') === 0)
res.end('windows');
elseif (buf.indexOf('darwin') === 0)
res.end("Mac os x");
elseif (buf.indexOf('linux') === 0)
res.end("linux");
});
srv.listen(3000);
console.log("Listening to Port 3000");
The most helpful NODEJS solutions
get user ipNODEJS Click to see more ... 7.6K 1.7K