Easily Build GraphQL APIs with Prisma

  1. Working With GraphQL Fragments and Mutations
  2. Building a Client For Your GraphQL API
  3. Writing Your First GraphQL Query
  4. Easily Build GraphQL APIs with Prisma

The technology sector is reeling after an official statement was released by the UN’s International Council of Coolness last week. The statement clearly states what status-quo developers have feared for months: if you haven’t shifted from REST to GraphQL by now, you are officially recognized by the international community to hold “uncool” status. A humanitarian crisis is already unfolding as refugees of coolness are threatening to overtake borders, sparking fears of an influx of Thinkpad Laptops, IntelliJ, and other Class A uncool narcotics.

Hold up: is GraphQL That Dramatic of an Improvement over REST?

In all honesty, I’ve found that the only way to properly answer this question is to first utter “kinda,” then mull back and forth for a little while, and then finishing with a weak statement like “so pretty much, yeah.”

Let’s put it this way. When you’re first familiarizing yourself with a set of data, what do you do? Do you read extensive documentation about the SQL table you’re about to check out? Do you read the entire spec for your version PostgreSQL to see if it contains the functionality that might be missing for some reason? I’m going to guess you do neither of these- chances are you just look at the data.

Using any REST API is inherently a context-switch. No matter how many APIs you’ve worked with in the past, you’ll never be able to know a new API’s endpoints, quirks, or the awful manner in which the creator has abandoned any distinction between GET, POST, or PUT methods altogether. GraphQL is not necessarily more technologically impressive than REST, but it does provide us a syntax and workflow comparable to working directly with databases with which we’re already familiar.

Remember when us young guys justified replacing older devs when we came out of the gate with NodeJS, arguing that context-switching changes everything? GraphQL is just that: a “better” technology with less mental context-switching, which conveniently serves a double-purpose for enterprises looking to fire anybody they perceive to be dead weight over the age of 30. Good luck finding a better synopsis than that.

What’s this Prisma Nonsense?

Prisma is a free (FREE!) service that provides with the tools to create an API client, as well as an Admin panel to manage it. Without any prior knowledge of GraphQL needed, Prisma provides us with:

  • A CLI which’s stand up a web server which will serve as our API: either cloud or self-hosted.
  • Automatic integration with your database of choice (including cloud DBs, such as RDS).
  • A clever obfuscation of data models via a simple config file. No classes, no code, no bullshit.
  • A “playground” interface which allows us to mess around in GraphQL syntax against our models without breaking everything.
  • A web GUI which displays the relationships between all of these things and their usage.

#graphql #devops #nodejs #node

Easily Build GraphQL APIs with Prisma