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

123
Views
What do my NodeJs Firebase read/write functions actually return?

I come from a language with no promises :-(

I want to code some NodeJS utility functions like these to interface with FireBase. It is my understanding that all FB functions return a promise (but, feel free to correct me).

exports.writeToFireBase(url, value){
    try{
        promise = await admin.database().ref(url).set(value);   
        return promise;
    }

    catch(exception){
        exports.unhandledException(exception);
    }
}

 exports.readFromFireBase(url){
    try{
        let value = admin.database().ref(url).once("value");

        return value;
    }

    catch(exception){
        exports.unhandledException(exception);
    }
}

What are functions actually returning?

In the write case, I guess it is either a promise, or nothing?

In the read case, will my function return the actual data, or a promise to that data? Await looks to me like it is blocking, but I suspect that I am wrong, and that promise to the data is returned from my read function.

Can someone please clarify, before I base too much code on erroneous assumptions?

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!