Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

119
Views
How to store data in the firebase realtime database

i need to store some simple data on the firebase realtime database, i've connected my app to the firebase realtime database, and imported all the requirments in the javascript file, but whenever my code is done, i check the realtime database and find that nothing is stored, i've followed many tutorials on youtube, even the firebase tutorial on youtube, but the mentionned problem stays, the realtime database stays empty as if i didn't write any code. Here is the javascript code :

import { initializeApp } from 'firebase/app';
import { getDatabase, ref, set } from 'firebase/database';


const firebaseConfig  = initializeApp({
    apiKey: "AIzaSyChK5qg7AJi0_AZQAc2iWnvDVJjyJvz5iI",
    authDomain: "mycoolapp-4373a.firebaseapp.com",
    databaseURL: "https://mycoolapp-4373a-default-rtdb.firebaseio.com",
    projectId: "mycoolapp-4373a",
    storageBucket: "mycoolapp-4373a.appspot.com",
    messagingSenderId: "895684408479",
    appId: "1:895684408479:web:3341db270dcd768e085eaa"
});
const app = initializeApp(firebaseConfig);

function writeUserData(userId, username, email, message) {
    const db = getDatabase();
    const reference = ref(db, 'users/' + userId);

    set(reference, {
        username: username,
        email: email,
        message: message
    });
}

writeUserData("andrew","andrew__8","andrew@gmail.com", "hey..i'm andrew!!");

is there any other working way ?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!