@nestjs/platform-express

  • Version 7.6.17
  • Published
  • 43.6 kB
  • 5 dependencies
  • MIT license

Install

npm i @nestjs/platform-express
yarn add @nestjs/platform-express
pnpm add @nestjs/platform-express

Overview

Nest - modern, fast, powerful node.js web framework (@platform-express)

Index

Functions

function AnyFilesInterceptor

AnyFilesInterceptor: (localOptions?: MulterOptions) => any;

    function FileFieldsInterceptor

    FileFieldsInterceptor: (
    uploadFields: MulterField[],
    localOptions?: MulterOptions
    ) => any;

      function FileInterceptor

      FileInterceptor: (fieldName: string, localOptions?: MulterOptions) => any;

        function FilesInterceptor

        FilesInterceptor: (
        fieldName: string,
        maxCount?: number,
        localOptions?: MulterOptions
        ) => any;

          Classes

          class ExpressAdapter

          class ExpressAdapter extends AbstractHttpAdapter {}

            constructor

            constructor(instance?: any);

              method close

              close: () => Promise<unknown>;

                method createMiddlewareFactory

                createMiddlewareFactory: (
                requestMethod: any
                ) => (path: string, callback: Function) => any;

                  method disable

                  disable: (...args: any[]) => any;

                    method enable

                    enable: (...args: any[]) => any;

                      method enableCors

                      enableCors: (options: CorsOptions | CorsOptionsDelegate<any>) => any;

                        method engine

                        engine: (...args: any[]) => any;

                          method getRequestHostname

                          getRequestHostname: (request: any) => string;

                            method getRequestMethod

                            getRequestMethod: (request: any) => string;

                              method getRequestUrl

                              getRequestUrl: (request: any) => string;

                                method getType

                                getType: () => string;

                                  method initHttpServer

                                  initHttpServer: (options: any) => void;

                                    method listen

                                    listen: {
                                    (port: string | number, callback?: () => void): any;
                                    (port: string | number, hostname: string, callback?: () => void): any;
                                    };

                                      method redirect

                                      redirect: (response: any, statusCode: number, url: string) => any;

                                        method registerParserMiddleware

                                        registerParserMiddleware: () => void;

                                          method render

                                          render: (response: any, view: string, options: any) => any;

                                            method reply

                                            reply: (response: any, body: any, statusCode?: number) => any;

                                              method set

                                              set: (...args: any[]) => any;

                                                method setBaseViewsDir

                                                setBaseViewsDir: (path: string | string[]) => any;

                                                  method setErrorHandler

                                                  setErrorHandler: (handler: Function, prefix?: string) => any;

                                                    method setHeader

                                                    setHeader: (response: any, name: string, value: string) => any;

                                                      method setLocal

                                                      setLocal: (key: string, value: any) => this;

                                                        method setNotFoundHandler

                                                        setNotFoundHandler: (handler: Function, prefix?: string) => any;

                                                          method setViewEngine

                                                          setViewEngine: (engine: string) => any;

                                                            method status

                                                            status: (response: any, statusCode: number) => any;

                                                              method useStaticAssets

                                                              useStaticAssets: (path: string, options: ServeStaticOptions) => any;

                                                                class MulterModule

                                                                class MulterModule {}

                                                                  method register

                                                                  static register: (options?: MulterModuleOptions) => any;

                                                                    method registerAsync

                                                                    static registerAsync: (options: MulterModuleAsyncOptions) => any;

                                                                      Interfaces

                                                                      interface MulterModuleAsyncOptions

                                                                      interface MulterModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {}

                                                                        property inject

                                                                        inject?: any[];

                                                                          property useClass

                                                                          useClass?: Type<MulterOptionsFactory>;

                                                                            property useExisting

                                                                            useExisting?: Type<MulterOptionsFactory>;

                                                                              property useFactory

                                                                              useFactory?: (
                                                                              ...args: any[]
                                                                              ) => Promise<MulterModuleOptions> | MulterModuleOptions;

                                                                                interface MulterOptionsFactory

                                                                                interface MulterOptionsFactory {}

                                                                                  method createMulterOptions

                                                                                  createMulterOptions: () => Promise<MulterModuleOptions> | MulterModuleOptions;

                                                                                    interface NestExpressApplication

                                                                                    interface NestExpressApplication extends INestApplication {}
                                                                                    • Interface describing methods on NestExpressApplication.

                                                                                      See Also

                                                                                      • [Platform](https://docs.nestjs.com/first-steps#platform)

                                                                                    method disable

                                                                                    disable: (...args: any[]) => this;
                                                                                    • A wrapper function around native express.disable() method.

                                                                                      Returns

                                                                                      {this}

                                                                                      Example 1

                                                                                      app.disable('x-powered-by')

                                                                                    method enable

                                                                                    enable: (...args: any[]) => this;
                                                                                    • A wrapper function around native express.enable() method.

                                                                                      Returns

                                                                                      {this}

                                                                                      Example 1

                                                                                      app.enable('x-powered-by')

                                                                                    method engine

                                                                                    engine: (...args: any[]) => this;
                                                                                    • A wrapper function around native express.engine() method.

                                                                                      Returns

                                                                                      {this}

                                                                                      Example 1

                                                                                      app.engine('mustache', mustacheExpress())

                                                                                    method set

                                                                                    set: (...args: any[]) => this;
                                                                                    • A wrapper function around native express.set() method.

                                                                                      Returns

                                                                                      {this}

                                                                                      Example 1

                                                                                      app.set('trust proxy', 'loopback')

                                                                                    method setBaseViewsDir

                                                                                    setBaseViewsDir: (path: string | string[]) => this;
                                                                                    • Sets one or multiple base directories for templates (views).

                                                                                      Returns

                                                                                      {this}

                                                                                      Example 1

                                                                                      app.setBaseViewsDir('views')

                                                                                    method setLocal

                                                                                    setLocal: (key: string, value: any) => this;
                                                                                    • Sets app-level globals for view templates.

                                                                                      Returns

                                                                                      {this}

                                                                                      Example 1

                                                                                      app.setLocal('title', 'My Site')

                                                                                      See Also

                                                                                      • https://expressjs.com/en/4x/api.html#app.locals

                                                                                    method setViewEngine

                                                                                    setViewEngine: (engine: string) => this;
                                                                                    • Sets a view engine for templates (views).

                                                                                      Returns

                                                                                      {this}

                                                                                      Example 1

                                                                                      app.setViewEngine('pug')

                                                                                    method useStaticAssets

                                                                                    useStaticAssets: {
                                                                                    (options: ServeStaticOptions): this;
                                                                                    (path: string, options?: ServeStaticOptions): this;
                                                                                    };
                                                                                    • Sets a base directory for public assets.

                                                                                      Returns

                                                                                      {this}

                                                                                      Example 1

                                                                                      app.useStaticAssets('public')

                                                                                    Type Aliases

                                                                                    type MulterModuleOptions

                                                                                    type MulterModuleOptions = MulterOptions;

                                                                                      Package Files (9)

                                                                                      Dependencies (5)

                                                                                      Dev Dependencies (2)

                                                                                      Peer Dependencies (2)

                                                                                      Badge

                                                                                      To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                      You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@nestjs/platform-express.

                                                                                      • Markdown
                                                                                        [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@nestjs/platform-express)
                                                                                      • HTML
                                                                                        <a href="https://www.jsdocs.io/package/@nestjs/platform-express"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>