A
A
Alexander Gamov2019-09-23 19:43:54
PostgreSQL
Alexander Gamov, 2019-09-23 19:43:54

Which bundle to choose for GraphQl server?

I want to give entities for the application through GraphQl (just lists of entities with filtering by relationships). There is already a full database (postgres), the business logic is all on Laravel.
I started to study a little, the choice fell on a bunch of graphql-yoga + TypeORM, but I ran into some difficulties.
To begin with, TypeOrm is apparently designed for the fact that the database will be created from its migrations, so when describing entities, you must explicitly set the names of the fields, tables and pivot tables in the database. According to the documentation, I could not figure it out everywhere (now I ran into the ManyToMany relationship). Plus, it is very inconvenient to debug such requests in the console

SELECT DISTINCT "distinctAlias"."Doctor_id" as "ids_Doctor_id" FROM (SELECT "Doctor"."id" AS "Doctor_id", "Doctor"."name" AS "Doctor_name", "Doctor"."img" AS "Doctor_img", "Doctor"."date_start_practice" AS "Doctor_date_start_practice", "Doctor"."rating" AS "Doctor_rating", "Doctor__clinics"."id" AS "Doctor__clinics_id", "Doctor__clinics"."name" AS "Doctor__clinics_name", "Doctor__clinics"."description" AS "Doctor__clinics_description", "Doctor__clinics"."institution" AS "Doctor__clinics_institution", "Doctor__clinics"."phone" AS "Doctor__clinics_phone", "Doctor__clinics"."img" AS "Doctor__clinics_img" FROM "doctors" "Doctor" LEFT JOIN "clinic_doctor" "Doctor_Doctor__clinics" ON "Doctor_Doctor__clinics"."doctorsId"="Doctor"."id" LEFT JOIN "clinics" "Doctor__clinics" ON "Doctor__clinics"."id"="Doctor_Doctor__clinics"."clinicsId" WHERE "Doctor"."id" IN ($1)) "distinctAlias" ORDER BY "Doctor_id" ASC LIMIT 1 -- PARAMETERS: ["31"]

Perhaps there are more suitable links with a detailed tutorial, or can you recommend good articles or seen me on this topic? (rus, eng)
So far I have found an English-language channel for myself where they explain it well, but apparently this is not enough for me.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Gamov, 2019-09-25
@slowdream

Switched to sequelize, more like a lara orm

A
Andrey, 2019-09-23
@VladimirAndreev

But what prevents you from installing a graphql package for Laravel and implementing a server on it?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question