This package has been deprecated
Notice: the development of the package is discontinued. Use it for educational purposes and hobby projects only.
Currently the consumption of HTTP REST APIs dominate the client-side world, GraphQL aims to change this. This transition can be time-consuming - this is where graffiti comes into the picture.
We don't want to rewrite our application - no one wants that. graffiti provides an Express middleware, a Hapi plugin and a Koa middleware to convert your existing models into a GraphQL schema and exposes it over HTTP.
What is GraphQL?
GraphQL is a query language created by Facebook in 2012 which provides a common interface between the client and the server for data fetching and manipulations.
The client asks for various data from the GraphQL server via queries. The response format is described in the query and defined by the client instead of the server: they are called client‐specified queries.
For more info check out RisingStack's GraphQL tutorial.
Example server and queries
For a running example server and executable queries, check out our example repository and play with your GraphQL queries: graffiti-example
- more coming...
npm install @risingstack/graffiti --save
- run MongoDB
- register the middleware
- provide a schema (returned by an adapters
getSchemamethod or your own
- the GraphQL endpoint is available on
;;;;;;const app = ;// parse body as jsonapp;app;app;
;;;const server = ;server;server;
;;;;;;const app = ;app;app;app;
GraphQLSchemainstance. You can use an adapters
getSchemamethod, or provide your own schema. (required)
graphiql: may present GraphiQL when loaded directly from a browser. (default:
context: custom GraphQL context object. (default: