Socket.io Engine.io problems “?EIO=4&transport=polling&t=OUAHy-a 404”

When I try to connect the client to my website with socket.io, it just spams
https://example.com/socket.io/?EIO=4&transport=polling&t=OUAHy-a 404 (At other times the request has just timed out instead of 404) repeatedly in the client console.
Here is the client html:

<!DOCTYPE html>
<html>
  <head>
    <title>Zesty testy</title>
  </head>
  <body>
    <script src="https://cdn.socket.io/4.4.1/socket.io.js"></script>
    <script src="./client.js"></script>
  </body>
</html>

And here is the client js:

const socket = io();

At last, here is the server js:

var app = require('express')(); 
var server = require('http').Server(app); 
var io = require('socket.io')(server);

io.on('connection', (socket) => {
  console.log('a user connected');
});

server.listen(3000, () => {
  console.log('listening on *:3000');
});

I have looked at many other questions alike mine, but no answer has been able to change the outcome.
Most of the code is from the socket.io webpage, with some slight change. I have been trying to get this to word for so long, and I will happily answer any questions to try and get this work. Thanks! (I am not using localhost.)

The expected result is for the Engine.io request thing to have status code 200 instead of 404, and the server console to display that a user has connected.