Skip to content

QuickFire is a quick way to get up and running with Firebase on Node.

Notifications You must be signed in to change notification settings

devchakraborty/quickfire

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QuickFire

QuickFire is a quick way to get up and running with Firebase on Node. Just create a model:

// Article.js

import { Model } from 'quickfire'

export default class Article extends Model {}

And that's it!

Currently supported methods:

  • Model.create(attributes)
  • Model.find(id)
  • Model.count()
  • modelInstance.update(attributes)
  • modelInstance.set(attributes)
  • modelInstance.delete()
co(function*() { // Use co to avoid callback hell, but you can use promises if you want
  // Create an article
  var article = yield Article.create({
    title: "Super provocative headline",
    url: "https://www.clickbaitnews.com"
  })

  // Update only the title key
  article = yield article.update({
    title: "More reasonable headline"
  })

  // Replace all keys (except id, createdAt, updatedAt)
  article = yield article.set({
    content: "Persuasive article content."
  })

  let articleId = article.id // UUID
  let articleCreatedAt = article.createdAt // Set automatically upon .create()
  let articleUpdatedAt = article.updatedAt // Set automatically upon .create(), .update(), .set()

  let sameArticle = yield Article.find(articleId) // Look up by UUID
  let numArticles = yield Article.count() // Number of articles, 1

  yield article.delete() // Delete the article
})

About

QuickFire is a quick way to get up and running with Firebase on Node.

Resources

Stars

Watchers

Forks

Packages

No packages published