GraphQL with Data Base - node.js

I just started GraphQL via tutorial and a question remains unanswered.
I intend to create an API with PostgreSQL that would be consumed by my graphQL instance but I have a question.
I have always done REST and used an MVC architecture and I wonder if it is not overkill to create methods and a router to ultimately transform them back via graphQL?
I intend to consume my API for an application in VUEJS and on mobile fluttering.
Does anyone have any advice to better prepare my API and not be redundant?
thanks in advance

Related

REST mapping to GraphQL

We are currently developing an online shop for products in node.js. We use GraphQL in our backend. Now we would like to offer REST for our customers in addition to GraphQL. What would be the fastest and most effective solution for this problem?
When designing REST APIs one should start from database tables aka persistent entities and there are too many ways and frameworks.
When you have GraphQL already in place you may want your REST API to be somewhat similar, but I bet that made things more complicated, while pure REST evolved as simple HTTP implementation.
In face HTTP standard and REST standard have the same author(s).

How to implement Algolia in Express.js?

I am just starting to dive into the Algolia world. There are many things that I do not quite understand. I have a task to implement Algolia in a web app. The web app is using Express + GraphQL on the backend and React on the front. Also, as the persistence layer, the app is using Postgresql. I think I have a good grasp of what needs to be done on the front, but not on the back. More specifically, I do not understand how to push data from my backend to Algolia.
Should I first query my data and then feed it to index.addObjects? If so, how then I programmatically and periodically run this “push” script?
Building an app using Algolia requires several steps.
First you need to upload your data using addObjects. Then you need to configure your index with the dashboard. And then you should build your UI. For that purpose, there is a library called react-instantsearch that makes creating search UI easy.
Finally you want to keep your data in sync, and for that you should implement a slightly different version of your initial import that pushes the data as they are updated in your database. Ideally it should only update the differences.

How to send documents from my mongodb database to android application?

I want to connect mongodb server to android application so that i can send data( which is stored online on mongodb ,not locally) to android user. I want to do it through REST api using node.js but couldn't find a way to do it.
Please help.
First of all it's a bad idea to connect to the Database directly. It is possible, but it'a a bad idea.
It's a much better practice to create a web service backend that your app can connect to. This will allow you to implement the business logic on the server. And additionally, you will be able to use not only Android, but iOS, AngularJS and others as clients too.
Generally the most common rest backend architecture looks something like this:
REST BACKEND
I find this way of development to be modular and very well organized.
In short, the API layer only takes HTTP GET and POST methods, and calls the appropriate functions in the Service layer. The service layer holds all of your business logic and calls the DAO layer, and Dao call anb works with the DB.
There's tons of examples for how to build web services, and it's highly dependent on your language of choice for your web tier. There are also tons of examples for consuming web services on Android. You should look it up.
But whatever language you choose the API -> Service -> Dao -> Database scheme should work fine.
If you don't know where to start take a look at Python Flask or Java Spring as good candidates for developing web services. (I use Spring because there is a ton of great documentation on whatever you may need.)
Hope this helps a bit. Good luck!

What potholes are there Using Graphql with RethinkDb?

As I understand it's possible graphql with rethinkdb. You can use graphql to query really any data set as its just the middleware really. What issues do I need to watch out for in this implementation? Server will be node.js in my case.
Documentation / examples of others doing this seam lacking.
I'm using GraphQL together with RethinkDb and don't see any particular problems in using them together compared to an implementation of a rest api or using mongo etc.
Here are two github projects using GraphQL and RethinkDb (the first one is more lightweight):
Isomorphic Material Relay Starter Kit
meatier

firebase custom user signup

I'm still a newbie in firebase so i might not have the right understanding of this excellent service.
I'm building a blogging mobile app in a client-server architecture in which most if not all the logic are done server-side. all the client does is request and display the result. the client-server communication will be in REST API. and post-processing data then will be pushed to firebase.
keep in mind that this is all still a work in progress and i still don't have an actual working setup yet.
my questions are:
1. is this possible?
2. is this good practice?
a 2nd architecture I'm thinking is to have the client talks with firebase directly and have the nodejs process any events coming from firebase.
same 2 questions as above3. which is better?
mind you i'm also a newbie in nodejs and just start to learn nodejs for this purpose.
Many Thanks in Advance

Resources