Open scottkelder opened 5 years ago
RESTful API relies on static endpoints. Front end makes a query to '/Endpoint' and receives data as predefined by the server code which has a prebuilt DB query for the HTTP verb used in endpoint request.
In GraphQL, the Query type is used to make a query to the database directly from the front end. The Query defines what data fields (sometimes call datums) it wants and doesn't need to rely on prebuilt endpoints.
For example, Express.js vs GraphQL:
Express:
app.get('/hello', function (req, res) { res.send('Hello World!') })
GraphQL:
const resolvers = { Query: { hello: () => { return 'Hello world!'; }, }, };
In Express, the user needs to make a GET request to '${URL}/hello' to receive back 'Hello World!'
In GraphQL, one would have to make a query:
query { hello }
Investigate database options. Looking at NoSQL and Graph-based options. James used Postgres so it would be productive to come to understand his methodology