I would just like to set up a template engine locally, as my workflow now is rendering the tempalte and having to go to my aws-s3 bucket to see the results.
In the NestJS docs the hace an example using:
import { NestFactory } from '@nestjs/core';
import { NestExpressApplication } from '@nestjs/platform-express';
import { join } from 'path';
import { AppModule } from './app.module';
async function bootstrap() {
const app = await NestFactory.create<NestExpressApplication>(
AppModule,
);
app.useStaticAssets(join(__dirname, '..', 'public'));
app.setBaseViewsDir(join(__dirname, '..', 'views'));
app.setViewEngine('hbs');
await app.listen(process.env.PORT ?? 3000);
}
bootstrap();
By creating this instance const app = await NestFactory.create<NestExpressApplication>(AppModule);
But I am using INestApplication and when check the instance none of those methods exist? Isn't NestJS built on top of Express? How would you use templates locally so I can do logs in my templates etc, so I don't have to go to my aws-bucket after every save.
Thanks!
INestApplicationapp.appbeingINestApplicationis already connected with expressAdapter, i mean -app.usewill be directly using.usefrom express and so on..create<NestExpressApplication>which tells nest to useexpressunderneath. If you want to use some direct methods from express, you can use(app as NestExpressApplication)[example:(app as NestExpressApplication).disable('x-powered-by)` that disables express ,,x-powered-by'' header for responses.