Содержимое index.html
<!doctype html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/3.1.1/socket.io.min.js"></script>
<script>
const socket = io("http://localhost:3000");
</script>
</body>
</html>
Содержимое index.ts
import mongoose from 'mongoose';
import express from 'express';
import bodyParser from "body-parser";
import {UserController, dialogController} from "./controlers";
import MessageController from "./controlers/MessageController";
import {updateLastSeen,checkAuth} from "./middleware";
import dotenv from 'dotenv';
const app = express()
const http = require('http').Server(app);
const io = require('socket.io')(http);
// @ts-ignore
const port = 3000
const User = new UserController();
const Dialog = new dialogController();
const Messages = new MessageController();
app.use(bodyParser.json());
app.use(updateLastSeen);
app.use(checkAuth)
dotenv.config();
mongoose.connect('mongodb://localhost:27017/chat', {useNewUrlParser: true, useUnifiedTopology: true,useCreateIndex: true});
app.get('/user/me',User.getMe)
app.get('/user/:id',User.show)
app.post('/user/registration', User.create)
app.delete('/user/:id', User.delete)
app.post('/user/login', User.login)
app.get('/dialogs/',Dialog.index);
app.post('/dialogs',Dialog.create);
app.delete('/dialogs/:id',Dialog.delete);
app.get('/messages',Messages.index);
app.post('/messages',Messages.create);
app.delete('/messages/:id',Messages.delete);
// @ts-ignore
io.on('connection', function (socket){
console.log("user connect")
})
http.listen(process.env.PORT, () => {
console.log(`Example app listening at http://localhost:${port}`)
})
Сама ошибка