标签:https doc mod rom 文件 name listen module roo
Docs: https://docs.nestjs.com/techniques/mvc
import {
NestFactory
} from '@nestjs/core';
import {
AppModule
} from './app.module';
import { join } from 'path'
async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.useStaticAssets(join(__dirname, '..', 'public')) // http://localhost:5000/xxx.txt
// app.useStaticAssets('public') 跟上面一样
await app.listen(5000);
}
bootstrap();
yarn add fastify point-of-view handlebars fastify-static
import {
NestFactory,
FastifyAdapter
} from '@nestjs/core';
import {
AppModule
} from './app.module';
import { join } from 'path'
const l = console.log;
async function bootstrap() {
const app = await NestFactory.create(AppModule, new FastifyAdapter());
app.useStaticAssets({
root: join(__dirname, '..', 'public'),
prefix: '/static/',
}); // http://localhost:5000/static/xxx.txt
await app.listen(5000)
}
bootstrap();
标签:https doc mod rom 文件 name listen module roo
原文地址:https://www.cnblogs.com/ajanuw/p/9574535.html