Every line of 'ng serve port' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
39 public start(port: number): void { 40 this.app.get('*', (req, res) => { 41 res.send(this.SERVER_STARTED + port); 42 }); 43 this.app.listen(port, () => { 44 Logger.Imp(this.SERVER_STARTED + port); 45 }); 46 }
144 (function startServer(port) { 145 server = expressApp.listen(port, function() { 146 console.log('Starting express server at localhost:%d', port); 147 done(); 148 }); 149 150 server.on('error', function(err) { 151 if (err.code === 'EADDRINUSE') { 152 console.warn('Port %d already in use.', port); 153 startServer(++port); 154 } 155 }); 156 })(port);
137 async serveProject(options: AngularServeOptions): Promise { 138 const [ externalIP, availableInterfaces ] = await this.selectExternalIP(options); 139 140 const port = options.port = await findClosestOpenPort(options.port); 141 142 const ng = new AngularServeCLI(this.e); 143 await ng.serve(options); 144 145 return { 146 custom: ng.resolvedProgram !== ng.program, 147 protocol: options.ssl ? 'https' : 'http', 148 localAddress: 'localhost', 149 externalAddress: externalIP, 150 externalNetworkInterfaces: availableInterfaces, 151 port, 152 externallyAccessible: ![BIND_ALL_ADDRESS, ...LOCAL_ADDRESSES].includes(externalIP), 153 }; 154 }
9 start() { 10 let port = this.config.get('port') 11 this.app.listen(port) 12 }
66 public get port(): number { 67 const address = this._server.address(); 68 return (address as AddressInfo).port; 69 }
15 public listen(port: number, callback?: Function): http.Server { 16 return this.app.listen(port, callback); 17 }