I have a project that needs to call a REST API (auth, and other CRUD endpoints). And I'm wondering what would be the most suitable stack based on preact and redux.
Would you use thunk, sagas or other alternative?
And how can you adapt the preact redux example: https://github.com/developit/preact-redux-example
Related
I want to make a general refactor to my app that will mover from react.js (client-side)
to next js with SSR, where I will use the following props to pre-render data... and my app pages,
export async function getServerSideProps(context) {
return {
props: {}, // will be passed to the page component as props
}
}
how to does firebase charge for the SSR ? since it is not a cloud function, technically for next.js app to be hosted on firebase there should be a server time, as I understood the idea, how is this server time goin to be calculated in the context of the hosting and out of the context of cloud functions, please elaborate if I misunderstand the concept behind ssr with next.js and firebase.
Firebase Hosting on its own will never execute any of your code on its servers.
If you run a web app that performs Server-Side Rendering on Firebase, you are using Cloud Functions or Cloud Run to execute that code for which Firebase Hosting provides convenient connectors.
So if you get the server-side timestamp in SSR, that's also where any billing for such server-side code comes from. Also see this line from the Firebase documentation on using web frameworks:
Prerequisites
...
Optional: Billing enabled on your Firebase project (required if you plan to use SSR).
For a good primer on hosting server-side dynamic content on Firebase Hosting, see the documentation on serving dynamic content and host microservices using Firebase Hosting.
I'd like to use NEXT.JS API routes with GraphQL subscriptions, but I can't find any information on the subject.
I know that the NEXT.JS API routes (deployed to Vercel) use cloud functions under the hood, and the cloud functions are only executed when you make a request and after a while they turn off.
Does it work well with sockets that seem to be used by third party libraries (graphql-yoga, apollo-server) to make subscriptions work?
I'm studying a course on AngularFire and it's going over subscribing to firebase. However, doesn't .onSnapshot provide the same observable functionality? .onSnapshot updates my array with changes from firestore in realtime...so why would we use angularFire to subscribe if you can just use the .onSnapshot method?
AngularFire exists as a way of using firebase functionality in a way which generally suits angular programming better. All of AngularFire's functionality is just a wrapper over the equivalent functionality in the javascript firebase objects.
The major way in which AngularFire helps you is that is uses rxjs and thus returns the observables that angular likes so well. Angular is built around observables and in general things go well with observables.
So simply put what AngularFire gives you is an observable in place of the callback that you would get using firebase directly.
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
What is the scope of implementing a micro-service architecture using firebase cloud functions? Is it a correct way to do it or is it a step backward. As we have seen fire base is built to be server less application back-end, But with multiple triggers and support for HTTPS should we try to get back to micro services. Just to try I have implemented multiple services on firebase cloud functions which had multiple URLs, they had a really good response time averaging at 500ms
This is a very challenging question to answer. It is not a step backward, you can think of Cloud Functions as a tool that you can use along with other technologies to implement your microservice strategy. For instance, if you are going to be leveraging the Firebase Database, and other features within Firebase then it makes sense to use the Cloud Functions for Firebase.
Let's say you don't want to use Cloud Functions for Firebase and you choose another technology such as Kubernetes or App Engine. First, you'll have to add the firebase SDKs to that stack and make sure it can access your Firebase project. You get access for free in Cloud Functions for Firebase. Next, you will write the same code that you would implement in the Cloud Function. Finally, you will have additional steps for deploying those technologies. Leveraging Cloud Functions for Firebase will be quicker and more productive.
As time goes on it will become more apparent when to use an additional technology. I recently wrote a blog post about when I would choose Container Engine over Cloud Functions. This topic can become subjective since it's really based on your needs, features, and the technologies you are working with.
Cloud Functions vs Container Engine