Package Exports
- @nestjs/serve-static
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@nestjs/serve-static) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
A progressive Node.js framework for building efficient and scalable server-side applications, heavily inspired by Angular.
Description
Serve Static module for Nest.
Installation
$ npm i --save @nestjs/serve-static
Example
See full example here.
Usage
Simply import ServeStaticModule
in your Nest application.
import { Module } from '@nestjs/common';
import { join } from 'path';
import { ServeStaticModule } from '@nestjs/serve-static';
@Module({
imports: [
ServeStaticModule.forRoot({
rootPath: join(__dirname, '..', 'client'),
}),
],
})
export class ApplicationModule {}
API Spec
The forRoot()
method takes an options object with a few useful properties.
Property | Type | Description |
---|---|---|
rootPath |
string | Static files root directory. Default: "client/dist" |
renderPath |
string | Path to render static app. Default: * (wildcard - all paths) |
serveStaticOptions |
Object | Serve static options (static files) |
Support
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.
Stay in touch
- Author - Kamil Myśliwiec
- Website - https://nestjs.com
- Twitter - @nestframework
License
Nest is MIT licensed.