Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • 1
    Hi, I can run it correctly, but it shows Cannot GET /. I use AWS EC2 to run the server. Commented Nov 4, 2016 at 18:55
  • 1
    @Wei Hi, late answer. From what I can see from a quick Google search it looks like your directory structure might be wrong. There must be an index.html file in the location you are targeting. Setting up the above example to run should take 5 minutes and I double checked that it works as is. From there you can tweak the path to suit your directory structure and check that the server still finds the files it needs to server. Commented Dec 3, 2016 at 14:22
  • path.join(__dirname, 'public') is more cross-platform. Commented Aug 2, 2017 at 20:09