How to store frontend routes on server

Viewed 48

I have frontend routing in my SPA + MPA project. The user can post an article and it will be available at the URL /article/id. In some cases, the author of the article should receive a notification from the server in the form of an email containing a link to his article. Given that the routing is client-side, the server must somehow get this URL. The question is: What are the solutions to organize this storage or receipt of the URL?

I can just hardcode the links I want in the backend. But then changing the frontend routing will invalidate the links that the backend knows.

Another way is to allocate one route like /entity?type=article&id=42 and delegate resolving links to the frontend. The problem is that in SPA it would be enough to add this route to single place, but in the case of SPA + MPA, I will have to duplicate this route for each page.

The case with articles is invented as an example. There are many entities in the project that the server needs to know the references to.

What other options are there to do this?

0 Answers
Related