Closed gongwg closed 7 years ago
Hi @gongwg ! In JavaScript, the statement !variable does a lot all at once, not just a null check. In particular, !variable includes the check variable.length == 0, which is what is happening here: it checks that protohost is an empty string.
Oh, aha, I get it. Thanks for your apply, @dougwilson :)
In the file index.js, there may be a coding problem in the function of next(). In this function, I find there is a segment of code below: if (route.length !== 0 && route !== '/') { removed = route; req.url = protohost + req.url.substr(protohost.length + removed.length);
It first references the "length" property of "protohost" object, which indicates that "protohost" must not be NULL. However, in the next line, the if statement's condition contains "!protohost", which checks wether the "protohost" is NULL or not, indicating that the "protohost" may be NULL. This is a contradiction. Perhaps a coding problem here?