Gathering detailed insights and metrics for @nestjs/serve-static
Gathering detailed insights and metrics for @nestjs/serve-static
Gathering detailed insights and metrics for @nestjs/serve-static
Gathering detailed insights and metrics for @nestjs/serve-static
Serve static websites (SPA's) using Nest framework (node.js) đ„Š
npm install @nestjs/serve-static
Module System
Unable to determine the module system for this package.
Min. Node Version
Typescript Support
Node Version
NPM Version
464 Stars
1,614 Commits
60 Forks
6 Watching
7 Branches
19 Contributors
Updated on 28 Nov 2024
TypeScript (93.29%)
JavaScript (5.67%)
Shell (1.04%)
Cumulative downloads
Total Downloads
Last day
0.1%
59,161
Compared to previous day
Last week
3.5%
327,758
Compared to previous week
Last month
12.1%
1,363,456
Compared to previous month
Last year
95.3%
16,352,351
Compared to previous year
1
5
A progressive Node.js framework for building efficient and scalable server-side applications.
@nestjs/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.
1$ npm i --save @nestjs/serve-static
See full example here.
Simply import ServeStaticModule
in your Nest application.
1import { Module } from '@nestjs/common'; 2import { join } from 'path'; 3import { ServeStaticModule } from '@nestjs/serve-static'; 4 5@Module({ 6 imports: [ 7 ServeStaticModule.forRoot({ 8 rootPath: join(__dirname, '..', 'client') 9 }) 10 ] 11}) 12export class ApplicationModule {}
The forRoot()
method takes an options object with a few useful properties.
Property | Type | Description |
---|---|---|
rootPath | string | Static files root directory. Default: "client" |
serveRoot | string | Root path under which static app will be served. Default: "" |
renderPath | string / RegExp | Path to render static app (concatenated with the serveRoot value). Default: * (wildcard - all paths). Note: RegExp is not supported by the @nestjs/platform-fastify . |
exclude | string[] | 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. |
serveStaticOptions | Object | Serve static options (static files) |
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.
Nest is MIT licensed.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
30 commit(s) and 3 issue activity found in the last 90 days -- score normalized to 10
Reason
license file detected
Details
Reason
5 existing vulnerabilities detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More