Welcome to the Linux Foundation Forum!

Quick server exercise returns 404 error.

I'm going through section 3 Service Mocking. Running the quick file server example returns a 404 error no matter what port I use.

Anyone else have this problem?

Answers

  • Hi, Mats,
    if you are not at the top level of your project's directory, you will get that error.
    When you type:
    $ npx serve -p 5050 static
    You are telling the server to look up the 'static' directory. If you are inside the 'static' directory, the server will not see the files that it needs to serve from that directory

  • sreus
    sreus Posts: 1

    try changing the src in the to "./app.js" in the html file. That fixed it for me

Categories

Upcoming Training