Unable to run web server with VS Code

Hi, folks. I recently finished the FreeCodeCamp curriculum, and I’m trying to wean myself off of some of the tools we’ve used to simplify the development process, namely Glitch, to prepare for my first programming job. I have an Express app that I built on Glitch that I’m trying to recreate on my local machine with VS Code, and I’m missing something in the setup process. When I use the Live Server plugin, instead of the app loading as it does in Glitch, I’m just getting a page that shows a directory of the files in my project. I’m not really even sure where to start in figuring out what this might be or how to fix it. Any insight into a potential cause would be much appreciated.
The Glitch project can be found here: https://glitch.com/edit/#!/nyt-spelling-bee-helper
A GitHub repo of the VS Code project can be found here: https://github.com/LuosRestil/SpellingBeeHelper2

Hello :slight_smile:!

Did you install the browser extension too? If not, you need it for it to work.

Anyway, the plugins seems to be unmaintained, so I would suggest using nodemon instead.

I do the following:

  1. Run the following on the terminal: npm i —save-dev nodemon
  2. Next, update the package.json scripts property by adding the following (a sub property): ”watch”: “nodemon server.js”
  3. Finally, run: npm run watch

That way the every time a file changes the server will reload.

I’m writing from my phone, hence the double quotes may be wrong, be careful and replace them on your code.

Hope it helps :smiley:

1 Like

Commenting on my own post here in case anyone else runs into this problem. The biggest missing piece was I didn’t realize I needed a terminal command to start running the server. Following skaparate’s suggestions, I abandoned Live Server, installed nodemon, then ran the server with npm run watch. From here, to get the app running in the browser, I had to manually type in the address bar http://localhost:3000, which is the port my app begins listening at after running from the terminal command.

1 Like