Iam trying to implement redux crud operations using rest service calls. Iam able to fetch details but unable to perform create update and delete operations in rest service call.
Can you please help me out with sample template
Related
I am currently creating a marketplace mobile application from scratch and I'm using React Native for the front-end part and Firebase for the backend (using Firebase and Firestore).
I am wondering wether :
I should create a RESTful API using cloud functions and express to create API endpoints (that would connect to firebase and firestore) that I'd call from my redux actions in my React Native app (using redux thunk).
or, I should call firebase and firestore directly from redux actions.
I see couple pros and cons for each method.
Restful API pros :
Safer as I can check and manipulate submitted data more easily
Custom API reply (I can manipulate the return data)
Restful API cons :
Probably slower as I would have to call an API endpoint that will then call firebase and/or firestore.
Won't be as easy to set listeners on firestore data
What do you think about it ?
Which option should I choose knowing that I predict that the app will get a few thousand users daily. I want it to be as fast and safe as possible and be able to set listeners for notifications purposes.
In my opinion you should mix them, if you have to manage users, products or etc. Firebase produces client and admin sdk that has different roles. If you haven't need manage any data of products or users or etc. you can simply use client sdk.
My advise is you can use admin sdk on API (server-side) and feel free to use client sdk on your clients.
Use as managements on API, listening data, realtime chat etc. via client sdk.
You can check admin and client sdk. Also npm packages for React Native here.
Mixing will be of help, you can try:
Listen for small amounts of data using the client SDK
Write and sort data using the cloud functions
In my experience, writing to a firebase database that uses ordered ids (in my case) leads to some huge problems in the long run. I lost a good chunk of data when my app accidentally wrote to a root index instead of a child index when the app was resumed from inactivity because the android system cleared the RAM.
Also, for notification, use Firebase Cloud Messaging.
The work method Firebase suggests and recommends is to link the Front-End application directly with the FireStore database service, and this provides real-time synchronization between the data in the Front-End application and the documents in FireStore, which is managed by the AdminSDK Firebase.
However, I would like to implement a business layer (following a micro-services architecture) with Spring-boot, but in this case it is up to me to manage the synchronization in real time between my micro-services and the front-end application.
So, How to efficiently develop spring-boot microservice that synchronise data in real-time with firestore of Google Firebase Cloud ?
Which framework or protocole I would use to brige this fonctionality ?
In my opinion, you could pass this by adding fabiomaffioletti (specific connector to firebase -- you could find it on github), you can refactor your entities by changing it to #FirebaseDocument("/people") to the entry point on firebase /people,
This denpendency would give the same actions as a normal repository by creating an interface anotate by repository that can give spring boot the possibility to scan the
repositories
#Repository
public class PeopleRepository extends DefaultFirebaseRealtimeDatabaseRepository<People, long> {
}
Don't forget to add #EnableFirebaseRepositories on your main apllication class.
Finaly on your properties file add this properties to precise the firebase end-point:
firebase.service-account-filename=[classpath|file]:[service-account-filename].json
firebase.realtime-database-url=[realtime database url]
Hope this would help you.
My apologize for my bad english :D
Newbie here.
In Angular 5 application with instantsearch.js library, how do I reload Algolia cache from my model on CRUD operations? I am using Cloud Firestore as my database and I have a cloud function to sync the data with Algolia.
Currently, I have to refresh the browser for changes to take effect.
You should have a request sent to your frontends with for example websockets, when it gets a "new data" event like that, you should call search.refresh().
whateverListenerYouHave.on('data', () => search.refresh());
See also the docs, and some relevant issues: instantsearch.js#2670 and instantsearch.js#1050
In the context of Angular InstantSearch, you'll need to make a connector to have access to the search (instance of InstantSearch.js)
I have few charts to render in the UI. The data has been populated from multiple tables using a web API service. Whenever a change in the data, I get a notification in the web API service. My question is that, is it possible use signalr to refresh data real-time.
Is it possible to invoke a signalr client methods from the web API service? Your help is highly appreciated.
It is possible to invoke client methods from outside the hub. You need to use GlobalHost to do that. You can find more details in the tutorial.
I am testing out this android chat application using Bluemix https://github.com/IBM-Bluemix/chatbot-watson-android
At some point in the conversation I will need to call a REST API/webservice to retrieve info about data that has been gathered and send it back to the user as a chat.
I don't want to do it from within the android application as the application wont work when I deploy it to another platform (e.g. slack).
Is there a way to call REST APIs from within watson?
I don't think the conversation service can do it directly, but can it link to another Bluemix service and use the result of that?
If you are already using some form of middleware this can be achieved by setting an action tag in the .JSON editor of the node that should fire the action. This then gets picked up by your middleware listener.
Alternatively try the new cloud actions feature that has just been released here https://console.bluemix.net/docs/services/conversation/dialog-actions.html#dialog-actions which is really simple and easy
I would create a server to intermediate the communication between your app (android) and the conversation service. This server could call/retrieve the required data before sending the conversation response to your app.
As you're using Bluemix, you could use Node-Red to easily do this.
Here is an example of an app that I made exactly this.
If you are starting with Watson and Bluemix, I strongly advice trying to use the Node-red starting pack. It's really easy to integrate Watson services and call REST API/web-services, even integrate with a database.
Here is a starting point to this:
https://nodered.org/docs/platforms/bluemix
Happy coding!