workshopper / learnyounode

Learn You The Node.js For Much Win! An intro to Node.js via a set of self-guided workshops.
Other
7.25k stars 1.84k forks source link

Exercise 10 problem #663

Closed johnfredrick closed 5 years ago

johnfredrick commented 5 years ago

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.

johnfredrick commented 5 years ago

Solved it. Seems like the exercise requires you to solve it without the use of the strftime package.