event and act accordingly:

    process.stdin.on('data', function(data) {
      if (data.toString().trim().toLowerCase() === 'quit') {
        conn.end();
        process.stdin.pause();
      }
    });

Note that you are also ending the standard input stream, letting Node know you are not interested in it.

This does not work very well because you are still trying to pipe everything to the server regardless if it is the string quit or not, which means you might be sending data to a closed connection. Instead you need to remove the following piping command:

    process.stdin.pipe(conn);

You must send that data only when the user is not quitting:

    process.stdin.on('data',{
            req.session.user = users[req.body.username];
            res.redirect('/users');
          } else {
            res.redirect('/session/new')
          }
        });

      app.del('/session', function(req, res, next) {
        req.session.destroy();
        res.redirect('/users');
      });

    };

Here you are placing the new route middleware callback function right before the final listener one. Express will take care of chaining the route