Hey guys, pretty new here and to the whole GraphQL...
# orm-help
p
Hey guys, pretty new here and to the whole GraphQL thing as well 🙂 Currently I am doing some studies to evaluate GraphQL (with Prisma) vs. an existing REST API (inclusive Swagger, TypeORM as our ORM) to see if it is worth it to replace parts of the REST API. Therefore I am thinking about some key features to compare both. My thoughts so far (no specific order): 1.) Data quantity (like over-/underfetching); 2.) Ecosystem and tools for developer; 3.) Documentation of the API itself (Introspection vs. Swagger); 4.) Community; 5.) Learning curve, complexity; 6.) Testability. 7.) One endpoint vs. many endpoints; 8.) Performance (not sure how to test this, since it is more about the implementation of my resolvers I guess). So, that's all so far. Do you have any ideas, hints or suggestions? Appreciate any answer 🙂
r
Hey @pzaenger 👋 Great question indeed! 1. Over/Under fetching is handled by using select and include so you’re set there. 2. The ecosystem is great! Full type-safety and great DX so the DB fields that you write are backed by autocompletion and intellisense of your editor 3. You can use any documentation required. Swagger, GraphQL Playground, or any thing of your choice. Prisma doesn’t provide any sort of documentation, but there’s a community plugin for that. 4. There’s Slack here and Twitter so the community is quite large. 5. Learning curve is quite easy as you are supported by auto-completion so all fields and the API is known to you. 6. There is an example of testing here. 7. I didn’t get this point. Could you elaborate? 8. Yes this is more on implementation of the resolvers and right now there are a couple of improvements to be made in this area.
👍 1
p
Thanks for your reply and your insights @Ryan 🙂 I will take a look at the links you provided, looks promising. According 7.) In GraphQL you have one endpoint
/graphql
vs. in REST you have many endpoints like
GET /items
,
GET /items/:id
,
DELETE /items/:id
and so on (typical CRUD stuff). Though I am not sure if one can say whether one endpoint is an (possible) advantage or not (a REST API can contain quite a lot of endpoints).
r
Ohh. That is independent of Prisma. You can use Prisma with either REST or GraphQL as its just a database access layer 🙂
p
Yeah, true 🙂 Actually I am thinking about replacing TypeORM with Prisma for all my database access stuff since I am not that happy with TypeORM.
r
Go ahead! You would find Prisma’s type-safety and API amazing once you get started 🙂