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)](/doc/en/lb4/apidocs.http-server.httpserver._constructor_.html) Constructs a new instance of the `HttpServer` class

Properties

Property Modifiers Type Description
[address](/doc/en/lb4/apidocs.http-server.httpserver.address.html) `readonly` string \| AddressInfo \| undefined Address of the HTTP / HTTPS server
[host](/doc/en/lb4/apidocs.http-server.httpserver.host.html) `readonly` string \| undefined Host of the HTTP / HTTPS server
[listening](/doc/en/lb4/apidocs.http-server.httpserver.listening.html) `readonly` boolean State of the HTTP / HTTPS server
[port](/doc/en/lb4/apidocs.http-server.httpserver.port.html) `readonly` number Port number of the HTTP / HTTPS server
[protocol](/doc/en/lb4/apidocs.http-server.httpserver.protocol.html) `readonly` [HttpProtocol](/doc/en/lb4/apidocs.http-server.httpprotocol.html) Protocol of the HTTP / HTTPS server
[server](/doc/en/lb4/apidocs.http-server.httpserver.server.html) `readonly` http.Server \| https.Server
[serverOptions](/doc/en/lb4/apidocs.http-server.httpserver.serveroptions.html) `readonly` [HttpServerOptions](/doc/en/lb4/apidocs.http-server.httpserveroptions.html)
[url](/doc/en/lb4/apidocs.http-server.httpserver.url.html) `readonly` string URL of the HTTP / HTTPS server

Methods

Method Modifiers Description
[start()](/doc/en/lb4/apidocs.http-server.httpserver.start.html) Starts the HTTP / HTTPS server
[stop()](/doc/en/lb4/apidocs.http-server.httpserver.stop.html) Stops the HTTP / HTTPS server