6 examples of 'ng serve port' in JavaScript

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.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
39public 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);
137async 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}
9start() {
10 let port = this.config.get('port')
11 this.app.listen(port)
12}
66public get port(): number {
67 const address = this._server.address();
68 return (address as AddressInfo).port;
69}
15public listen(port: number, callback?: Function): http.Server {
16 return this.app.listen(port, callback);
17}

Related snippets