There are few things that could not be working here. It can be because of something you did or the editor. The good news is that it can be fixed. We just need more info.
First of all, it is great you tried another solution and you shared it with us. This really helps. My first question is: What editor are you using to edit your code? Are you running the code from this editor? I am guessing you are running the code directly from the browser via local host. I just want to confirm this.
Things are a bit more tricky because you are trying to run this code via localhost. I do not have one setup right now, at least not one with express.
Let us know if this helps.