1

I have an HTML page template (player.html) which displays Football players information and information is loaded on to page using a rest API call. When the user select "Ronaldo" from a dropdown, Ronaldo's profile will be loaded to a HTML page called player.html. When "Messi" is selected as the option, the HTML page will display Messi's information.

Irrespective of the player selection my application URL remains the same (https://example.com/player.html) in the current scenario.

I would like to change URL to https://example.com/messi or https://example.com/ronaldo based on the user selection. I know it's possible if I render the page from server side. As my template is very complicated, I am finding it tough to render from server and also I feel it's difficult to maintain.

Can some one suggest an alternate to point two URLs to same HTML template?

I am using Nodejs Express framework for the backend and HTML & boostrap CSS framework for the front end development.

1

Well you can use two separate routes for Messi and Ronaldo and render the same template.

As in selecting the players, it can be setup such that when the user selects each player it redirects to that player's route.

Do comment if it's not what you want. I feel like I have not fully understood what you need.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.