ojoanalogo / nestjs-redoc

📘 ReDoc frontend for you NestJS swagger API documentation
MIT License
146 stars 55 forks source link

Incompatibility with Nest MVC techniques #13

Closed aaaee2 closed 3 years ago

aaaee2 commented 4 years ago

nestjs-redoc rewrites views directory base path and templates engine of the application, ruining Nest MVC techniques: https://docs.nestjs.com/techniques/mvc#model-view-controller

Nest:

app.setBaseViewsDir(join(__dirname, '..', 'views'));
app.setViewEngine('hbs');

nestjs-redoc (https://github.com/mxarc/nestjs-redoc/blob/master/src/redoc-module.ts#L97):

// Set app to use handlebars as engine
app.engine('handlebars', hbs.engine);
app.set('view engine', 'handlebars');
// Set views folder
app.set('views', join(__dirname, '..', 'views'));

Because of this, it is not possible to use nestjs-redoc and render project own pages at the same time.

ojoanalogo commented 4 years ago

Working on trying to find an alternative to app.set('views'), will update soon

ojoanalogo commented 3 years ago

Found the issue, for now on you will be able to use MVC techniques and this module alongside, will update this week to version 2.0

ojoanalogo commented 3 years ago

Hello, @aaaee2

Please try the latest version (2.0.3), I've modified the way redoc it's served from nestjs app, now it doesn't interfere with views directory.