From 17d53d2f90f7ac1eb0096e06344d871ca668f9fd Mon Sep 17 00:00:00 2001 From: Johannes Schickling Date: Thu, 1 Mar 2018 14:19:55 +0100 Subject: [PATCH] readme --- README.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4428364..b907d38 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,6 @@ Webpack loader for [`graphql-import`](https://github.com/graphcool/graphql-impor yarn add --dev graphql-import-loader ``` -## Usage - Add the following to the `rules` section in your `webpack.config.js` ```js @@ -22,3 +20,16 @@ Add the following to the `rules` section in your `webpack.config.js` use: [{ loader: 'graphql-import-loader' }] }], ``` + +## Usage + +You can now `require` or `import` `.graphql` files (resolved as strings) in your application: + +```ts +import { GraphQLServer } from 'graphql-yoga' +import resolvers from './resolvers' +import typeDefs from './schema.graphql' + +const server = new GraphQLServer({ typeDefs, resolvers }) +server.start(() => console.log('Server running on :4000')) +``` \ No newline at end of file