1.0.10 • Published 1 year ago

firebase-easy-functions v1.0.10

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

👽 Easy Firebase Functions

If you have no idea how to operate with firebase, or you don't wanna waste time writting basic operations in your project, this is your ideal package!

💾 Requirements

  • Firebase credentials
  • Node 16 or higher

Install

npm i firebase-easy-functions

First of all:

Create a "credentials.json" file in the root of the project and fill with your firebase credentials" Example:

{
  "apiKey": "",
  "authDomain": "",
  "projectId": "",
  "storageBucket": "",
  "messagingSenderId": "",
  "appId": ""
}

Captura desde 2022-11-27 18-49-25

⌨ Imports

Single imports

const { createCollection } = require('firebase-easy-functions')

Or multiple imports

const { createCollection, deleteCollection } = require('firebase-easy-functions')

Or ES6

import { createCollection } from 'firebase-easy-functions'
import { createCollection, deleteCollection } from 'firebase-easy-functions'

📀 Functions

createCollection(collectionName)

collectionName will be the name of the collection. The function will return successfull message.

deleteCollection(collectionName)

collectionName will be the name of the collection. The function will delete all the data in the collection and return true (bool)

createDocument(collectionName, documentId, object)

collectionName will be the name of the collection. documentId will be the "id" of your documment. object (optional) will be the data of your documment. The function will return the create firestore payload (_writtedocument, etc).

deleteDocument(collectionName, documentId)

collectionName will be the name of the collection. documentId will be the "id" of your documment. The function will return the delete firestore payload (_writtedocument, etc).

findById(collectionName, documentId)

collectionName will be the name of the collection, documentId will be the "id" of your documment. The function will return all the data of the document.

findAllDocuments(collectionName)

collectionName will be the name of the collection. The function will return all the documents in the collection.

collectionLength(collectionName)

collectionName will be the name of the collection. The function will return the length (in numbers) of the collection

getByPosition(collectionName, position)

collectionName will be the name of the collection, and position will be the specific position of a document you want The function will return the data that document.

findAllCollections()

The function will return a list of all the collections in your db

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago