Firebase file system file structure

So, I use firebase repository to upload files to my site. Here is an example directory structure:

Project ---------------------
         | __index.html
         | __css
              | __style.css
         | __js
                | __mainScript.js

So, I upload these files to firebase in this structure, but I notice that the returned downloadURL is not very friendly in saving this structure.

For example, when I set the src iframe to downloadURL for index.html .. there are no style and body text files on the iframe page.

This is how downloadURL for index.html looks like:

https://firebasestorage.googleapis.com/v0/b/App_ID.appspot.com/o/index.html?alt=media&token=some_uid

This is what downloadURL style.css looks like:

https://firebasestorage.googleapis.com/v0/b/App_ID.appspot.com/o/css%2Fstyle.css?alt=media&token=some_uid , etc.

Of course, the index.html file looks for the style.css file at:

https://firebasestorage.googleapis.com/v0/b/App_ID.appspot.com/o/css/style.css

but the result is 404.

Is there any way to solve this problem?

PS, of course, I don’t want the user to change the URLs in their files ...

+3
source share
1 answer

Do not use storage to save files on your site! Use Firebase hosting instead ... Firebase storage is intended for storing uploaded / uploaded files (images, audio, etc.).

https://firebase.google.com/docs/hosting/

+1

Source: https://habr.com/ru/post/1677731/


All Articles