1- # graphql-directives
1+ # graphql-directive
22
33[ ![ Build Status] [ build-badge ]] [ build ]
44[ ![ Code Coverage] [ coverage-badge ]] [ coverage ]
@@ -19,7 +19,7 @@ You can [learn more about directives in GraphQL documentation](http://graphql.or
1919## Install
2020
2121``` sh
22- npm install graphql-directives
22+ npm install graphql-directive
2323```
2424
2525## Steps
@@ -41,7 +41,7 @@ This code defines a directive called `dateFormat` that accepts one argument `for
4141The second step consists in adding a resolver for the custom directive .
4242
4343```js
44- import { addDirectiveResolveFunctionsToSchema } from 'graphql -directives '
44+ import { addDirectiveResolveFunctionsToSchema } from 'graphql -directive '
4545
4646// Attach a resolver map to schema
4747addDirectiveResolveFunctionsToSchema(schema, {
@@ -75,7 +75,7 @@ graphql(schema, query, rootValue).then(response => {
7575` addDirectiveResolveFunctionsToSchema ` takes two arguments, a GraphQLSchema and a resolver map. It modifies the schema in place by attaching directive resolvers. Internally your resolvers are wrapped into another one.
7676
7777``` js
78- import { addDirectiveResolveFunctionsToSchema } from ' graphql-directives '
78+ import { addDirectiveResolveFunctionsToSchema } from ' graphql-directive '
7979
8080const resolverMap = {
8181 // Will be called when a @upperCase directive is applied to a field.
@@ -113,7 +113,7 @@ Text formatting is a good use case for directives. It can be helpful to directly
113113
114114``` js
115115import { buildSchema } from ' graphql'
116- import { addDirectiveResolveFunctionsToSchema } from ' graphql-directives '
116+ import { addDirectiveResolveFunctionsToSchema } from ' graphql-directive '
117117
118118// Schema
119119const schema = buildSchema (`
@@ -129,15 +129,15 @@ addDirectiveResolveFunctionsToSchema(schema, {
129129})
130130```
131131
132- [ See complete example] ( https://github.com/smooth-code/graphql-directives /blob/master/examples/upperCase.js )
132+ [ See complete example] ( https://github.com/smooth-code/graphql-directive /blob/master/examples/upperCase.js )
133133
134134### Date formatting: ` @dateFormat(format: String) `
135135
136136Date formatting is a CPU expensive operation. Since all directives are resolved server-side, it speeds up your client and it is easily cachable.
137137
138138``` js
139139import { buildSchema } from ' graphql'
140- import { addDirectiveResolveFunctionsToSchema } from ' graphql-directives '
140+ import { addDirectiveResolveFunctionsToSchema } from ' graphql-directive '
141141import format from ' date-fns/format'
142142
143143// Schema
@@ -154,15 +154,15 @@ addDirectiveResolveFunctionsToSchema(schema, {
154154})
155155```
156156
157- [ See complete example] ( https://github.com/smooth-code/graphql-directives /blob/master/examples/dateFormat.js )
157+ [ See complete example] ( https://github.com/smooth-code/graphql-directive /blob/master/examples/dateFormat.js )
158158
159159### Authentication: ` @requireAuth `
160160
161161Authentication is a very good usage of ` FIELD_DEFINITION ` directives. By using a directive you can restrict only one specific field without modifying your resolvers.
162162
163163``` js
164164import { buildSchema } from ' graphql'
165- import { addDirectiveResolveFunctionsToSchema } from ' graphql-directives '
165+ import { addDirectiveResolveFunctionsToSchema } from ' graphql-directive '
166166
167167// Schema
168168const schema = buildSchema (`
@@ -179,7 +179,7 @@ addDirectiveResolveFunctionsToSchema(schema, {
179179})
180180```
181181
182- [ See complete example] ( https://github.com/smooth-code/graphql-directives /blob/master/examples/requireAuth.js )
182+ [ See complete example] ( https://github.com/smooth-code/graphql-directive /blob/master/examples/requireAuth.js )
183183
184184## Limitations
185185
@@ -195,11 +195,11 @@ addDirectiveResolveFunctionsToSchema(schema, {
195195
196196MIT
197197
198- [ build-badge ] : https://img.shields.io/travis/smooth-code/graphql-directives .svg?style=flat-square
199- [ build ] : https://travis-ci.org/smooth-code/graphql-directives
200- [ coverage-badge ] : https://img.shields.io/codecov/c/github/smooth-code/graphql-directives .svg?style=flat-square
201- [ coverage ] : https://codecov.io/github/smooth-code/graphql-directives
202- [ version-badge ] : https://img.shields.io/npm/v/graphql-directives .svg?style=flat-square
203- [ package ] : https://www.npmjs.com/package/graphql-directives
204- [ license-badge ] : https://img.shields.io/npm/l/graphql-directives .svg?style=flat-square
205- [ license ] : https://github.com/smooth-code/graphql-directives /blob/master/LICENSE
198+ [ build-badge ] : https://img.shields.io/travis/smooth-code/graphql-directive .svg?style=flat-square
199+ [ build ] : https://travis-ci.org/smooth-code/graphql-directive
200+ [ coverage-badge ] : https://img.shields.io/codecov/c/github/smooth-code/graphql-directive .svg?style=flat-square
201+ [ coverage ] : https://codecov.io/github/smooth-code/graphql-directive
202+ [ version-badge ] : https://img.shields.io/npm/v/graphql-directive .svg?style=flat-square
203+ [ package ] : https://www.npmjs.com/package/graphql-directive
204+ [ license-badge ] : https://img.shields.io/npm/l/graphql-directive .svg?style=flat-square
205+ [ license ] : https://github.com/smooth-code/graphql-directive /blob/master/LICENSE
0 commit comments