sodal-project / cartographer

Cartographer version 1 is a complete rewrite adding the concept of modules.
1 stars 0 forks source link

Client: Routing #15

Open tbenbow opened 1 month ago

tbenbow commented 1 month ago

We need the ability to store data about the state of the application in the URL. Some examples…

Module Dashboard localhost:3000/module1/

Module Item Detail localhost:3000/module1/item/[ID]

Module Settings localhost:3000/module1/settings

This will give us the ability to…

A strategy for this has not been selected but if we want to avoid page reloads this will need to be translated on the client not the server. Here’s how a solution may work. The url is updated and javascript detects this update. It then analyzes the current url and breaks the url into the following pieces…

localhost:3000/module1/item/[ID]

module1 - The module the core will send a message to item - The function in that module to call [ID] - The argument to send that function

The above url would call item function in module1 with the ID portion passed in as an argument.

  1. Create or select a routing system This system should take the url and transform it into module function calls. This system should enable any function in a module to be called with an unlimited amount of arguments.
  2. Routing Test Module Create a module that will test the ability of this system. The module can simply log a message when the route is hit.
tbenbow commented 1 month ago

Another approach...

When the url is refreshed we redraw the index page and trigger the function from within the root view.