Barcode scanner detection and fetch data from database

I have got the Cordova plugin set up in the html and I have added all of the data into firebase but does anyone know how I would link the barcode scanner to firebase so it would bring up the data when a user scans a certain barcode.

I would be really grateful for the help