import {Express, static as _static} from 'express'; import type {ConfigType} from './config/confighelper'; import catchAllRedirect from './middleware/CatchAllRedirect'; import {RegisterRoutes} from './tsoa.gen/routes'; import expressWs from 'express-ws'; export function registerRoutes(express: Express, config: ConfigType, ws: expressWs.Instance): void { RegisterRoutes(express); // (express as any as expressWs.Application).ws('ws/dashboard', (ws, req, next) => isAuthenticatedMiddleware(req, req.res!, next)); (express as any as expressWs.Application).ws('ws/dashboard', (ws, req) => { // ws.on('open', function () { // console.log(this); // }); // ws.on('message', function (msg) { // ws.send(msg); // }); }); express.use(_static('_client')); //for production express.use(catchAllRedirect(express, '/')); }