I'm building a NestJS microservice app in monorepo with fin as the default microservice.
I'm using EJS templating.
But once I run the project, I get the error, "ERROR [ExceptionsHandler] Failed to lookup view "index" in views directory "D:\Studio\Work...\fin\dist\apps\views"".
I've tried different configurations for directory path in app.setBaseViewsDir() but all have not worked;
Could you please help me spot the problem?
Thanks in advance!
The project directory folder looks something like below;
+ fin
+ apps
+ fin
+ src
+ views
-index.ejs
-app.controller.ts
-main.ts
+ image
-package.json
-tsconfig.json
The fin main.ts file looks something like;
main.ts:
import { NestFactory } from '@nestjs/core';
import { NestExpressApplication } from '@nestjs/platform-express';
import { resolve } from 'path';
import { AppModule } from './app.module';
async function bootstrap() {
const app = await NestFactory.create<NestExpressApplication>(AppModule);
app.useStaticAssets(resolve('../src/assets'));
app.setBaseViewsDir(resolve('../src/views'));
app.setViewEngine('ejs');
await app.listen(6006);
console.log(`Fin PEN started successfully on Port 6006`);
}
bootstrap();
The tsconfig.json looks like below.
tsconfig.json:
{
"compilerOptions": {
...
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./"
...
}
}