The instruction is to listen to Tcp connections and write the date for each connection in the format "YYYY-MM-DD hh:mm"
This is the code that achieves this:
var net = require('net');
var port = +process.argv[2];
var strftime = require('strftime');
var server = net.createServer(function(socket) {
socket.write(strftime('%F %H:%M'));
socket.end();
});
server.listen(port);
And running learnyounode run program.js, returns this:
"2019-03-18 10:01"
But still the code fails to be verified by the learnyounode program.
The instruction is to listen to Tcp connections and write the date for each connection in the format "YYYY-MM-DD hh:mm"
This is the code that achieves this:
And running learnyounode run program.js, returns this: "2019-03-18 10:01" But still the code fails to be verified by the learnyounode program.