As someone who is new to this, I kindly ask for your understanding as I navigate through the world of web development. I am putting in a lot of effort and learning along the way.
Currently, I have a live website hosted on Firebase. Users can access it by typing "domain.com/1" and it will display the file "index.html" located in a folder named "1". Everything is running smoothly so far.
Now, I want to share different content with my friend that corresponds to a specific ID, which in this case is 456. This content is stored in the Firebase database under a matching row.
I aim to provide my friend with a URL like "domain.com/1 + ID 456", where upon loading the page, they will see the content associated with ID 456 fetched from the database.
- What should the structure of this URL path be to include folder 1 and ID 456? Are there multiple ways to achieve this?
- How would the overall architecture look like? Would the user load the page's HTML (without content) along with the parameter 456, and would JavaScript on the client side retrieve the content from Firebase and populate the page? (I have implemented this approach using functions, but it seems rather slow.)
- Is it possible for the user to enter something like "domain.com/1?456" and redirect to a function on Firebase that fetches the data (456) and returns a fully-loaded page with the data included in one server call? If so, how can this be accomplished?
Which option – 2 or 3 – would be the best course of action to follow?