Set default host and port for ng serve in config file

后端 未结 12 2185
庸人自扰
庸人自扰 2020-12-07 07:53

I want to know if i can set a host and a port in a config file so I don\'t have to type

ng serve --host foo.bar --port 80

instead of just

12条回答
  •  死守一世寂寞
    2020-12-07 08:31

    This changed in the latest Angular CLI.

    The file name changed to angular.json, and the structure also changed.

    This is what you should do:

    "projects": {
        "project-name": {
            ...
            "architect": {
                "serve": {
                    "options": {
                      "host": "foo.bar",
                      "port": 80
                    }
                }
            }
            ...
        }
    }
    

提交回复
热议问题