How to use the @firebase/app.default.database function in @firebase/app

To help you get started, we’ve selected a few @firebase/app examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cheeaun / node-hnapi / lib / hnapi.js View on Github external
const firebase = require('@firebase/app').default;
require('@firebase/database');
var moment = require('moment');
var extend = require('extend');
var url = require('url');
var he = require('he');

firebase.initializeApp({
  databaseURL: 'https://hacker-news.firebaseio.com',
});
var hn = firebase.database().ref('/v0');
var hnRecentItems = hn.child('updates/items');

var typeMapping = {
  story: 'link'
};

var cleanText = function(html){
  if (!html) return;
  // yea yea regex to clean HTML is lame yada yada
  html = html.replace(/&lt;\/p&gt;/ig, ''); // remove trailing <p></p>s
  if (!html.match(/^<p>/i)) html = '</p><p>' + html; // prepend </p><p>
  return html;
}

var api = {
</p>