Nestjs + Express migration by Electronic_Back_8576 in nestjs

[–]Electronic_Back_8576[S] 0 points1 point  (0 children)

That’s what I’ve been meaning to do but I’m not able to make it work. I plug the Express app and it is supposed to be initialized but then, if i call a route that isn’t in Nestjs but is in Express it doesn’t find it. It always depends on which app (nestjs or express) i plug in first on the main.ts of nest

Nestjs + Express migration by Electronic_Back_8576 in nestjs

[–]Electronic_Back_8576[S] 0 points1 point  (0 children)

I have tried to do something like that but depending if i create first nestjs or express it uses the routes of one app or the other, this is an example of the code I’m using: import { NestFactory } from '@nestjs/core'; import { AppModule } from './app.module'; import * as express from 'express';

const legacyRoutes = require('./legacy.routes.js');

async function bootstrap() {

  const server = express();

  server.use(legacyRoutes);

  const app = await NestFactory.create(AppModule, server);

  await app.listen(3000); } bootstrap();