1.0.2 • Published 5 years ago

@beeman/nestjs-serve-static v1.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

Description

Serve Static module for Nest.

Installation

Or manually:

$ 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.

PropertyTypeDescription
rootPathstringStatic files root directory. Default: "client/dist"
renderPathstringPath to render static app. Default: * (wildcard - all paths)
serveStaticOptionsObjectServe 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

License

Nest is MIT licensed.