Files
llm/backend/src/routes.ts
2024-05-28 17:26:14 +02:00

21 lines
852 B
TypeScript

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, '/'));
}