jueves, 27 de septiembre de 2018

"host": 0.0.0.0 serve node.js angular.js


The .angular-cli.json file allows you to specify Angular-CLI configuration options; including the default hostname and port.
serve: Properties to be passed to the serve command
   port (number): The port the application will be served on. Default is 4200.
   host (string): The host the application will be served on. Default is localhost.
You can define the used port in the .angular-cli.json file by defining the property like this:
{
    "defaults": {
        "serve": {
            "port": 2500
        }
    }
}

See the Angular CLI documentation for more info and a complete listing of configuration options:https://github.com/angular/angular-cli/wiki/angular-cli

Command line solution
If you're looking for a command line solution that does not require and configuration editing, simply run the ng serve or ng serve --prod commands with the optional host and port commands.
ng serve --host 0.0.0.0 --port 4201
Using these optional command line parameters, you can simply run the command twice, each with different a host and port.

Side note: That being said, unless you are going to be serving your Angular application using the Angular CLI, you'll likely need to configure these options using the methods associated with your hosting platform.

No hay comentarios: