Page Contents

Home > @loopback/http-server > HttpServer

HttpServer class

HTTP / HTTPS server used by LoopBack’s RestServer

Signature:

export declare class HttpServer 

Constructors

Constructor Modifiers Description

(constructor)(requestListener, serverOptions)

Constructs a new instance of the HttpServer class

Properties

Property Modifiers Type Description

address

readonly

string | AddressInfo | undefined

Address of the HTTP / HTTPS server

host

readonly

string | undefined

Host of the HTTP / HTTPS server

listening

readonly

boolean

State of the HTTP / HTTPS server

port

readonly

number

Port number of the HTTP / HTTPS server

protocol

readonly

HttpProtocol

Protocol of the HTTP / HTTPS server

server

readonly

http.Server | https.Server

serverOptions

readonly

HttpServerOptions

url

readonly

string

URL of the HTTP / HTTPS server

Methods

Method Modifiers Description

start()

Starts the HTTP / HTTPS server

stop()

Stops the HTTP / HTTPS server