Handles the actions specific to the http server

Hierarchy

  • AsyncCreatable<WebServer.Options>
    • WebServer

Constructors

Properties

host: string = 'localhost'
port: number = WebOAuthServer.DEFAULT_PORT
server: Server<typeof IncomingMessage, typeof ServerResponse>
DEFAULT_CLIENT_SOCKET_TIMEOUT: number = 20_000

Methods

  • sends a response redirect.

    Parameters

    • status: number

      the statusCode for the response.

    • url: string

      the url to redirect to.

    • response: ServerResponse<IncomingMessage>

      the response to write the redirect to.

    Returns void

  • Parameters

    • response: ServerResponse<IncomingMessage>

    Returns Promise<void>

  • Parameters

    • response: ServerResponse<IncomingMessage>

    Returns Promise<void>

  • sends a response to the browser reporting an error.

    Parameters

    • error: Error

      the oauth error

    • response: ServerResponse<IncomingMessage>

      the HTTP response.

    Returns void

  • sends a response to the browser reporting the success.

    Parameters

    • response: ServerResponse<IncomingMessage>

      the HTTP response.

    Returns void

  • sends a response error.

    Parameters

    • status: number

      the statusCode for the response.

    • message: string

      the message for the http body.

    • response: ServerResponse<IncomingMessage>

      the response to write the error to.

    Returns void

  • Starts the http server after checking that the port is open

    Returns Promise<void>