IServerSettings Interface

Module
import { IServerSettings } from "@tsed/common"
Source/packages/common/src/config/interfaces/IServerSettings.ts

Overview

interface IServerSettings {
    rootDir?: string;
    env?: Env;
    port?: string | number;
    httpPort?: string | number | boolean;
    httpsPort?: string | number | boolean;
    httpsOptions?: Https.ServerOptions;
    uploadDir?: string;
    mount?: IServerMountDirectories;
    componentsScan?: (string | RegExp)[];
    exclude?: string[];
    serveStatic?: IServerMountDirectories;
    acceptMimes?: string[];
    debug?: boolean;
    logRequestFields?: ("reqId" | "method" | "url" | "headers" | "body" | "query" | "params" | "duration")[];
    validationModelStrict?: boolean;
    logger?: Partial<;ILoggerSettings>;;
    errors?: Partial<;IErrorsSettings>;;
    controllerScope?: ProviderScope;
    routers?: IRouterSettings;
    [key: string]: any;
}

Members

rootDir?: string

The root directory where you build run project. By default, it's equal to `process.cwd().


env?: Env

The environment profile. By default the environment profile is equals to NODE_ENV.


port?: string | number

Port number for the HTTP.Server.


httpPort?: string | number | boolean

Port number for the HTTP.Server.


httpsPort?: string | number | boolean

Port number for the HTTPs.Server.


httpsOptions?: Https.ServerOptions

Https.ServerOptions):

  • key <string> | <string[]> | <Buffer> | <Object[]>: The private key of the server in PEM format. To support multiple keys using different algorithms an array can be provided either as a plain array of key strings or an array of objects in the format {pem: key, passphrase: passphrase}. This option is required for ciphers that make use of private keys.
  • passphrase <string> A string containing the passphrase for the private key or pfx.
  • cert <string> | <string[]> | <Buffer> | <Buffer[]>: A string, Buffer, array of strings, or array of Buffers containing the certificate key of the server in PEM format. (Required)
  • ca <string> | <string[]> | <Buffer> | <Buffer[]>: A string, Buffer, array of strings, or array of Buffers of trusted certificates in PEM format. If this is omitted several well known "root" CAs (like VeriSign) will be used. These are used to authorize connections.

uploadDir?: string

The temporary directory to upload the documents. See more on Upload file with Multer


Mount all controllers under a directories to an endpoint.


componentsScan?: (string | RegExp)[]

List of directories to scan Services, Middlewares or Converters.


exclude?: string[]

List of glob patterns. Exclude all files which matching with this list when ServerLoader scan all components with the mount or scanComponents options.


Object to mount all directories under to his endpoints. See more on Serve Static.


acceptMimes?: string[]

Configure the mimes accepted by default by the server.


debug?: boolean

Enable debug mode. By default debug is false.


logRequestFields?: ("reqId" | "method" | "url" | "headers" | "body" | "query" | "params" | "duration")[]

validationModelStrict?: boolean

Use a strict validation when a model is used by the converter. When a property is unknown, it throw a BadRequest (see Converters). By default true.


logger?: Partial<;ILoggerSettings>;

Logger configuration.


errors?: Partial<;IErrorsSettings>;

Errors configuration.


controllerScope?: ProviderScope

Configure the default scope of the controllers.

  • Default: singleton. See Scope.
  • Values: singleton, request.

routers?: IRouterSettings

Global configuration for the Express.Router. See express documentation.


[key: string]: any