MCPcopy Index your code
hub / github.com/loopbackio/loopback-next / start

Method start

packages/rest/src/rest.server.ts:975–1004  ·  view source on GitHub ↗

* Start this REST API's HTTP/HTTPS server.

()

Source from the content-addressed store, hash-verified

973 * Start this REST API's HTTP/HTTPS server.
974 */
975 async start(): Promise<void> {
976 // Set up the Express app if not done yet
977 this._setupRequestHandlerIfNeeded();
978 // Setup the HTTP handler so that we can verify the configuration
979 // of API spec, controllers and routes at startup time.
980 this._setupHandlerIfNeeded();
981
982 const port = await this.get(RestBindings.PORT);
983 const host = await this.get(RestBindings.HOST);
984 const path = await this.get(RestBindings.PATH);
985 const protocol = await this.get(RestBindings.PROTOCOL);
986 const httpsOptions = await this.get(RestBindings.HTTPS_OPTIONS);
987
988 if (this.config.listenOnStart === false) {
989 debug(
990 'RestServer is not listening as listenOnStart flag is set to false.',
991 );
992 return;
993 }
994
995 const serverOptions = {...httpsOptions, port, host, protocol, path};
996 this._httpServer = new HttpServer(this.requestHandler, serverOptions);
997
998 await this._httpServer.start();
999
1000 this.bind(RestBindings.PORT).to(this._httpServer.port);
1001 this.bind(RestBindings.HOST).to(this._httpServer.host);
1002 this.bind(RestBindings.URL).to(this._httpServer.url);
1003 debug('RestServer listening at %s', this._httpServer.url);
1004 }
1005
1006 /**
1007 * Stop this REST API's HTTP/HTTPS server.

Callers

nothing calls this directly

Calls 6

_setupHandlerIfNeededMethod · 0.95
toMethod · 0.80
getMethod · 0.65
startMethod · 0.65
bindMethod · 0.45

Tested by

no test coverage detected