Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
firestore-service
Advanced tools
Create simple firestore queries using http request.
First you need to install the package.
npm install firestore-service
You will need to create a firestore data base. You can do it right here https://console.firebase.google.com/
Afterwards you will need to get the credentials for your db. You can get those on
Project Overview -> Add firebase to your web app
Note: We strongly recommend to save the credentials on a .env file and not upload them to any repository. With these credentials anyone can access your cloud db.
Once you have your credentials and the package install you can start using firestore service.
You will need to initialize the service as soon as you can.
import firestoreService from 'firestore-service'
const firebaseConfig = {
apiKey: xxxxxxxxxxxx,
authDomain: xxxxxxxxxxxx,
databaseURL: xxxxxxxxxxxx,
projectId: xxxxxxxxxxxx,
storageBucket: xxxxxxxxxxxx,
messagingSenderId: xxxxxxxxxxxx
};
firestoreService.INITIALIZE(firebaseConfig);
For all the examples we will be using the following database.
All the http methods will return a response with the following body.
{
ok: a boolean -> true: Success, false: Failure
data: The data you requested,
status: An http Code see the code table below,
statusText: 'OK' or 'Failure',
request: the actual request (GET, POST, etc.)
}
You can get all the elements from a collection by using get with the path towards the collection.
Note: Have in mind that the path will be 'collection/id/collection2/id2/.../collection' It will always finish with a collection.
const path = 'regions'
const response = await firestoreService.GET(path);
In the response there will be all the regions
const path = 'regions?id=NA'
const response = await firestoreService.GET(path);
In the response there will be all the attributes of the NA document.
You can update an element by calling POST with the path towards the collection, the id of the item to update and the body.
const path = 'regions/NA/users?id=123'
const body = {
name: 'New Name'
surname: 'New Surname'
};
firestoreService.POST(path, body)
You can delete a certain item from a collection by using DELETE with a path and an id as queryparam.
const path = 'regions/NA/users?id=123'
firestoreService.DELETE(path)
The user from the NA region with the id 123 will be deleted.
You can create a new element on a collection by using CREATE and the path towards the desire collection.
const path = 'regions/LAS/users'
const response = await firestoreService.CREATE(path)
In the response there will be the id to the created document.
You can update an element by calling POST with the path towards the collection, the id of the item to update and the body.
const path = 'regions/NA/users?id=123'
const body = {
name: 'New Name'
surname: 'New Surname'
};
firestoreService.PATCH(path, body)
OK: 200
CREATED: 201
NO_CONTENT: 204
BAD_REQUEST: 400
UNAUTHORIZED: 401
FORBIDDEN: 403
NOT_FOUND: 404
CONFLICT: 409
This project is licensed under the MIT License - see the LICENSE.md file for details
FAQs
Create firestore queries with simple HTTP methods
The npm package firestore-service receives a total of 0 weekly downloads. As such, firestore-service popularity was classified as not popular.
We found that firestore-service demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.