U. Friedrich
U. Friedrich

Reputation: 3

Angular2 app public URL without port number

What I have to config to access an Angular2 app from a remote server without a port number. For example: My server where wakanda is running is www.myserver.com and my Angular2 app is reachable via localhost:8000. Now I'll use something like www.myserver.com/myapp/ to see my Angular2 app. I've found the webpack.config.js, but no idea whether this is the right place to do it or what config to set.

Upvotes: 0

Views: 3146

Answers (3)

Darryl Yan
Darryl Yan

Reputation: 1

Public URLs by default map to port 80. You can specify ng serve --port 80 in your package.json file in your Angular2 directory so that the application is accessible without specifying port.

Upvotes: 0

Harleen Kaur Arora
Harleen Kaur Arora

Reputation: 2087

Check your protractor.conf.js file. In this file change your baseUrl.

baseUrl: 'your base url',

Upvotes: 0

Ignasi
Ignasi

Reputation: 731

No idea about what wakanda is, but only point you have to mind is your baseUrl, which for your localhost seems to be "/" and you want it to be "/myapp" in production.

You'll need to set it up in index.html inside the head tag like this:

<head>
  <base href="/myapp">
  ...
</head>

And in webpack config

output: {
  publicPath: '/myapp',
  ...
},

Upvotes: 0

Related Questions