added websocket updates
This commit is contained in:
@@ -2,9 +2,19 @@ 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) {
|
||||
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, '/'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user