NodeJS Cannot GET /

Problem description:
Not able to GET / on my socketio project

Expected behavior:
Display blank webpage

Actual behavior:
Cannot GET /

Steps to reproduce:

const express = require("express");
const socketio = require("socket.io");
const http = require("http");
const port = 3000;
const app = express();
const server = http.createServer(app);
const io = new socketio.Server(server);
app.use(express.static("public"));
server.listen(port, function() {
  console.log("App listening on port " + port);
});

Bug appears at this link:
https://replit.com/@d4s-over-dt4/SocketIO-Tutorial#index.js

Browser/OS/Device:
“Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0”

(For @imcute-aaaa :I am listening to your advice,but I think this is a bug,and I can’t have 2 tags for the same topic.)

  1. You named the folder “static” but referenced it as “public”
  2. Check your code before saying it is a bug with replit
2 Likes

Sorry.Ig that(referencing wrong folder) is the problem.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.