On these lines:
https://github.com/FACK1/Mylibrary/blob/master/src/server/homeHandler.js#L14-L17
You check if any cookies exist and then immediately try to encode the login cookie.
What happens if there is a cookie, but it's not called login (hint: your server will crash)
your if check if once parsed, the login cookie exists