sample(@nestjs) move public and views dirs outside of the src

This commit is contained in:
Kamil Myśliwiec
2018-07-05 09:10:10 +02:00
parent 3cf8607b20
commit 0c4fe26c21
8 changed files with 3156 additions and 1641 deletions

File diff suppressed because it is too large Load Diff

View File

View File

@@ -1,11 +1,12 @@
import { NestFactory } from '@nestjs/core';
import { join } from 'path';
import { ApplicationModule } from './app.module';
async function bootstrap() {
const app = await NestFactory.create(ApplicationModule);
app.useStaticAssets(__dirname + '/public');
app.setBaseViewsDir(__dirname + '/views');
app.useStaticAssets(join(__dirname + './../public'));
app.setBaseViewsDir(join(__dirname + './../views'));
app.setViewEngine('hbs');
await app.listen(3000);

File diff suppressed because it is too large Load Diff

View File

View File

@@ -1,18 +1,18 @@
import { NestFactory, FastifyAdapter } from '@nestjs/core';
import { ApplicationModule } from './app.module';
import { FastifyAdapter, NestFactory } from '@nestjs/core';
import { join } from 'path';
import { ApplicationModule } from './app.module';
async function bootstrap() {
const app = await NestFactory.create(ApplicationModule, new FastifyAdapter());
app.useStaticAssets({
root: join(__dirname, 'public'),
root: join(__dirname, './../public'),
prefix: '/public/',
});
app.setViewEngine({
engine: {
handlebars: require('handlebars'),
},
templates: join(__dirname, 'views'),
templates: join(__dirname, './../views'),
});
await app.listen(3000);
}