Options
All
  • Public
  • Public/Protected
  • All
Menu

Class HttpServer

Hierarchy

  • Server
    • HttpServer

Index

Constructors

constructor

  • Parameters

    Returns HttpServer

Properties

connections

connections: number

headersTimeout

headersTimeout: number

Limit the amount of time the parser will wait to receive the complete HTTP headers.

default

60000 https://nodejs.org/api/http.html#http_server_headerstimeout

keepAliveTimeout

keepAliveTimeout: number

listening

listening: boolean

maxConnections

maxConnections: number

maxHeadersCount

maxHeadersCount: number | null

Limits maximum incoming headers count. If set to 0, no limit will be applied.

default

2000 https://nodejs.org/api/http.html#http_server_maxheaderscount

router

router: Router = new Router()

timeout

timeout: number

Methods

addListener

  • addListener(event: string, listener: (...args: any[]) => void): this
  • addListener(event: "close", listener: () => void): this
  • addListener(event: "connection", listener: (socket: Socket) => void): this
  • addListener(event: "error", listener: (err: Error) => void): this
  • addListener(event: "listening", listener: () => void): this
  • events.EventEmitter

    1. close
    2. connection
    3. error
    4. listening

    Parameters

    • event: string
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

  • Parameters

    • event: "close"
    • listener: () => void
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "connection"
    • listener: (socket: Socket) => void
        • (socket: Socket): void
        • Parameters

          • socket: Socket

          Returns void

    Returns this

  • Parameters

    • event: "error"
    • listener: (err: Error) => void
        • Parameters

          Returns void

    Returns this

  • Parameters

    • event: "listening"
    • listener: () => void
        • (): void
        • Returns void

    Returns this

address

  • address(): AddressInfo | string | null
  • Returns AddressInfo | string | null

close

  • close(callback?: undefined | ((err?: Error) => void)): this
  • Parameters

    • Optional callback: undefined | ((err?: Error) => void)

    Returns this

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • emit(event: "close"): boolean
  • emit(event: "connection", socket: Socket): boolean
  • emit(event: "error", err: Error): boolean
  • emit(event: "listening"): boolean
  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

  • Parameters

    • event: "close"

    Returns boolean

  • Parameters

    • event: "connection"
    • socket: Socket

    Returns boolean

  • Parameters

    • event: "error"
    • err: Error

    Returns boolean

  • Parameters

    • event: "listening"

    Returns boolean

eventNames

  • eventNames(): Array<string | symbol>
  • Returns Array<string | symbol>

getConnections

  • getConnections(cb: (error: Error | null, count: number) => void): void
  • Parameters

    • cb: (error: Error | null, count: number) => void
        • (error: Error | null, count: number): void
        • Parameters

          • error: Error | null
          • count: number

          Returns void

    Returns void

getMaxListeners

  • getMaxListeners(): number

Private handleRequest

  • Parameters

    Returns Promise<void>

Abstract handlerResponse

  • handlerResponse(context: HttpContext): void | Promise<void>
  • Parameters

    Returns void | Promise<void>

listen

  • listen(port?: undefined | number, hostname?: undefined | string, backlog?: undefined | number, listeningListener?: undefined | (() => void)): this
  • listen(port?: undefined | number, hostname?: undefined | string, listeningListener?: undefined | (() => void)): this
  • listen(port?: undefined | number, backlog?: undefined | number, listeningListener?: undefined | (() => void)): this
  • listen(port?: undefined | number, listeningListener?: undefined | (() => void)): this
  • listen(path: string, backlog?: undefined | number, listeningListener?: undefined | (() => void)): this
  • listen(path: string, listeningListener?: undefined | (() => void)): this
  • listen(options: ListenOptions, listeningListener?: undefined | (() => void)): this
  • listen(handle: any, backlog?: undefined | number, listeningListener?: undefined | (() => void)): this
  • listen(handle: any, listeningListener?: undefined | (() => void)): this
  • Parameters

    • Optional port: undefined | number
    • Optional hostname: undefined | string
    • Optional backlog: undefined | number
    • Optional listeningListener: undefined | (() => void)

    Returns this

  • Parameters

    • Optional port: undefined | number
    • Optional hostname: undefined | string
    • Optional listeningListener: undefined | (() => void)

    Returns this

  • Parameters

    • Optional port: undefined | number
    • Optional backlog: undefined | number
    • Optional listeningListener: undefined | (() => void)

    Returns this

  • Parameters

    • Optional port: undefined | number
    • Optional listeningListener: undefined | (() => void)

    Returns this

  • Parameters

    • path: string
    • Optional backlog: undefined | number
    • Optional listeningListener: undefined | (() => void)

    Returns this

  • Parameters

    • path: string
    • Optional listeningListener: undefined | (() => void)

    Returns this

  • Parameters

    • options: ListenOptions
    • Optional listeningListener: undefined | (() => void)

    Returns this

  • Parameters

    • handle: any
    • Optional backlog: undefined | number
    • Optional listeningListener: undefined | (() => void)

    Returns this

  • Parameters

    • handle: any
    • Optional listeningListener: undefined | (() => void)

    Returns this

listenerCount

  • listenerCount(type: string | symbol): number
  • Parameters

    • type: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

off

  • off(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

on

  • on(event: string, listener: (...args: any[]) => void): this
  • on(event: "close", listener: () => void): this
  • on(event: "connection", listener: (socket: Socket) => void): this
  • on(event: "error", listener: (err: Error) => void): this
  • on(event: "listening", listener: () => void): this
  • Parameters

    • event: string
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

  • Parameters

    • event: "close"
    • listener: () => void
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "connection"
    • listener: (socket: Socket) => void
        • (socket: Socket): void
        • Parameters

          • socket: Socket

          Returns void

    Returns this

  • Parameters

    • event: "error"
    • listener: (err: Error) => void
        • Parameters

          Returns void

    Returns this

  • Parameters

    • event: "listening"
    • listener: () => void
        • (): void
        • Returns void

    Returns this

onException

  • Type parameters

    Parameters

    Returns void

once

  • once(event: string, listener: (...args: any[]) => void): this
  • once(event: "close", listener: () => void): this
  • once(event: "connection", listener: (socket: Socket) => void): this
  • once(event: "error", listener: (err: Error) => void): this
  • once(event: "listening", listener: () => void): this
  • Parameters

    • event: string
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

  • Parameters

    • event: "close"
    • listener: () => void
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "connection"
    • listener: (socket: Socket) => void
        • (socket: Socket): void
        • Parameters

          • socket: Socket

          Returns void

    Returns this

  • Parameters

    • event: "error"
    • listener: (err: Error) => void
        • Parameters

          Returns void

    Returns this

  • Parameters

    • event: "listening"
    • listener: () => void
        • (): void
        • Returns void

    Returns this

prependListener

  • prependListener(event: string, listener: (...args: any[]) => void): this
  • prependListener(event: "close", listener: () => void): this
  • prependListener(event: "connection", listener: (socket: Socket) => void): this
  • prependListener(event: "error", listener: (err: Error) => void): this
  • prependListener(event: "listening", listener: () => void): this
  • Parameters

    • event: string
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

  • Parameters

    • event: "close"
    • listener: () => void
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "connection"
    • listener: (socket: Socket) => void
        • (socket: Socket): void
        • Parameters

          • socket: Socket

          Returns void

    Returns this

  • Parameters

    • event: "error"
    • listener: (err: Error) => void
        • Parameters

          Returns void

    Returns this

  • Parameters

    • event: "listening"
    • listener: () => void
        • (): void
        • Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: string, listener: (...args: any[]) => void): this
  • prependOnceListener(event: "close", listener: () => void): this
  • prependOnceListener(event: "connection", listener: (socket: Socket) => void): this
  • prependOnceListener(event: "error", listener: (err: Error) => void): this
  • prependOnceListener(event: "listening", listener: () => void): this
  • Parameters

    • event: string
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

  • Parameters

    • event: "close"
    • listener: () => void
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "connection"
    • listener: (socket: Socket) => void
        • (socket: Socket): void
        • Parameters

          • socket: Socket

          Returns void

    Returns this

  • Parameters

    • event: "error"
    • listener: (err: Error) => void
        • Parameters

          Returns void

    Returns this

  • Parameters

    • event: "listening"
    • listener: () => void
        • (): void
        • Returns void

    Returns this

rawListeners

  • rawListeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

ref

  • ref(): this
  • Returns this

removeAllListeners

  • removeAllListeners(event?: string | symbol): this
  • Parameters

    • Optional event: string | symbol

    Returns this

removeListener

  • removeListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

setTimeout

  • setTimeout(msecs?: undefined | number, callback?: undefined | (() => void)): this
  • setTimeout(callback: () => void): this
  • Parameters

    • Optional msecs: undefined | number
    • Optional callback: undefined | (() => void)

    Returns this

  • Parameters

    • callback: () => void
        • (): void
        • Returns void

    Returns this

unref

  • unref(): this
  • Returns this

Static createContext

Generated using TypeDoc