2
votes

I am using polymer starter kit code and get the GUI with home, contact and user menu. I am using Java Dynamic Web Project in eclipse. So the base url is :

  • localhost:8080/TestProject/
    When I click home after clicking contact or user menu then it changes the url to :
  • localhost:8080

I have tried to set default base url in app.js file as:

  • app.baseUrl = '/TestProject/';

    But still the behaviour is the same.

If in routing.html, I make change like: -

page('/TestProject/', function() {
          app.route = 'home';
          setFocus(app.route);
        });

Nothing changes. But if I change in index.html:

<paper-menu class="app-menu" attr-for-selected="data-route" selected="[[route]]">
      <a data-route="home" href="{{baseUrl}}TestProject">
        <iron-icon icon="home"></iron-icon>
        <span>Home</span>
      </a>

Then the home url becomes:

http://localhost:8080/TestProject/#!/TestProject/

But it should be:

http://localhost:8080/TestProject/

or

http://localhost:8080/TestProject/#!/home

Guys where am I going wrong. Or where should I make change to achieve the home url.
Thanks a lot.

1
Try to delete / in the begining of the home path - Dmytro

1 Answers

1
votes

Newer versions of the PSK have following section in the router.html:

// Removes end / from app.baseUrl which page.base requires for production
if (window.location.port === '') {  // if production
  page.base(app.baseUrl.replace(/\/$/, ''));
}

page('/',updateRedux, function() {
  page.redirect('/start');
});

page(app.baseUrl,updateRedux, function() {
  page.redirect('/start');
});