I keep having issue with localhost:8000 not being able to “see” index.html file. I am using Deno on Mac and here are my html and javascript codes:
Javascript:
import { Application } from "https://deno.land/x/[email protected]/mod.ts";
// static server serves files from the public directory
// exitSignal is used to shut down the server when the process exits (ctrl-c)
import { createExitSignal, staticServer } from "../shared/server.ts";
// create web server and set it up to serve static files from public
const app = new Application();
app.use(staticServer);
// tell the user we are about to start
console.log("nListening on http://localhost:8000");
// start the web server
await app.listen({ port: 8000, signal: createExitSignal() });
Html:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Hello, Web</title>
</head>
<body>
<h1>Hello, Web!</h1>
<p>This static html page was served by hello_web.js</p>
</body>
</html>
I am running the server (meaning I do get signal that js is listening to server), but whenever I attempt to run related index.html file I keep receiving this error:
a 404 error screen in browser, with inspector turned on
Here is happily running server:
terminal screenshot saying “Listening on http://localhost:8000”
I am using macOS 13.2 (22D49) and Deno 1.42.1
I did restart computer, I did try duplicating the code. I tried running other files: index.html would open with no server, but server wouldn’t see index.html. I tried renaming the files. I tried cleaning up cache. I tried reverting code to the moment when it was working. Everything had same result of server not seeing index.html
How can I fix it?

