Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@7rulnik/nest-serve-static

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@7rulnik/nest-serve-static

Nest - modern, fast, powerful node.js web framework (@serve-static)

  • 2.2.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version Package License NPM Downloads Travis Linux Coverage Discord Backers on Open Collective Sponsors on Open Collective

Description

@7rulnik/nest-serve-static package for Nest, useful to serve static content like Single Page Applications (SPA). However, if you are building MVC application or want to serve assets files (images, docs), use the useStaticAssets() method (read more here) instead.

Installation

$ npm i --save @7rulnik/nest-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 '@7rulnik/nest-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"
serveRootstringRoot path under which static app will be served. Default: ""
renderPathstring / RegExpPath to render static app (concatenated with the serveRoot value). Default: * (wildcard - all paths). Note: RegExp is not supported by the @nestjs/platform-fastify.
excludestring[]Paths to exclude when serving the static app. WARNING! Not supported by fastify. If you use fastify, you can exclude routes using regexp (set the renderPath to a regular expression) instead.
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.

FAQs

Package last updated on 09 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc