Using Firebase Storage for Documents, Images, and more
Esta página aún no está disponible en tu idioma.
LaunchFa.st provides you with the APIs to interact with Firebase Storage, built on top of Web Standards.
You can configure it in the
src/pages/api/storage
directory. You can configure it in the
src/routes/api/storage/+server.ts
file. - Update the
firebaseConfig.ts
file to have the necessary variables for Firebase Storage:
-
In the Firebase console, open Settings > Service Accounts
-
Click Generate New Private Key, then confirm by clicking Generate Key
-
Securely store the JSON file containing the key
-
In the Firebase Console, Go to Storage, and save the value starting with gs://…
-
Update the JSON with the key storageBucket with the value obtained above
- To make it easier for you to implement file upload, just import the following component in your Svelte app:
- To fetch the uploaded file, make sure to persist the response containing the
fileURL
which’ll be used to fetch the original file. To do so, hit the following API: