Closed fdb closed 6 years ago
How do you plan to make requests to the REST API that firebase provides? AJAX?
I just tried this and was successfully able to make the GET
part of the request.
But to which URL are we supposed to send the POST
requests when saving the sketch.
Looks from the documentation like a POST request to /sketch/
with the data of the new sketch would to the trick. The return result gives you the new ID of the sketch as a name
.
Is it fine with you if I try posting some dummy data??
Maybe it's better if you create your own Firebase database, since this is our prod database.
It's free to make one, just go to firebase.com. Here are the rules we use:
{
"rules": {
"sketch": {
".read": true,
".write": true,
}
}
}
Yes! I think that will be a better option.
Okay, I was able to do GET
and POST
both on my firebase with Fetch API.
Should I try it on your codebase now?
Try the GET first :-)
Code has been merged.
We run into issues of too many connections when using Firebase during workshops. Each
Firebase has support for a REST API. E.g. this is how you can fetch a sketch: https://emrg-pcg.firebaseio.com/sketch/-L0iQdDbqd1vMVn7hgmo.json
Reference: https://firebase.google.com/docs/reference/rest/database/
Because we don't depend on the real-time aspect I would suggest replacing the Websocket connection with GET and POST requests across the app.