lei lei
lei lei

Reputation: 1829

Is it possible to configure port number for Angular application?

I am building an angular application. The app will connect with server through httpClient. Each time when the app connect to the server, it uses different port. I want to configure the port number of this app, then every time when the app open the socket to communicate with the server, the app will always use the same port.

It is possible to do that?

Upvotes: 5

Views: 773

Answers (1)

Sajeetharan
Sajeetharan

Reputation: 222582

With latest version of angular-cli, you can change the port by editing angular.json file you now specify a port per "project"

projects": {
    "my-cool-project": {
        ... rest of project config omitted
        "architect": {
            "serve": {
                "options": {
                    "port": 4500
                }
            }
        }
    }
}

Upvotes: 6

Related Questions