Skip to content

Commit 3bb43be

Browse files
committed
fix(Docs + NPM): Fix NPM install + docs update
1 parent d948c71 commit 3bb43be

File tree

3 files changed

+40
-1
lines changed

3 files changed

+40
-1
lines changed

.npmignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.DS_Store
2+
*.log
3+
src

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Kristoffer Klevenberg <[email protected]>

README.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,39 @@
11
# graphql-compose-dataloader
2+
[![Travis](https://img.shields.io/travis/stoffern/graphql-compose-dataloader.svg)]()
3+
[![npm version](https://img.shields.io/npm/v/graphql-compose-dataloader.svg?style=flat-square)](https://www.npmjs.com/package/graphql-compose-dataloader) [![npm](https://img.shields.io/npm/l/graphql-compose-dataloader.svg?style=flat-square)](https://github.com/stoffern/graphql-compose-dataloader/blob/master/LICENSE)
24
Add DataLoader to graphql-composer resolvers.
35

4-
This is a Work in progress... not working yet
6+
### Installation
7+
```
8+
npm install graphql-compose-dataloader --save
9+
```
10+
Modules `graphql`, `graphql-compose` are in `peerDependencies`, so should be installed explicitly in your app. They have global objects and should not have ability to be installed as submodule.
11+
12+
### Example
13+
```js
14+
import mongoose from 'mongoose';
15+
import composeWithMongoose from 'graphql-compose-mongoose';
16+
import composeWithDataLoader from 'graphql-compose-dataloader';
17+
18+
const LanguagesSchema = new mongoose.Schema({
19+
language: String,
20+
skill: {
21+
type: String,
22+
enum: [ 'basic', 'fluent', 'native' ],
23+
},
24+
});
25+
26+
const Languages = mongoose.model('UserModel', UserSchema)
27+
const LanguagesTC = composeWithDataLoader(composeWithMongoose(Languages),{cacheExpiration: 700})
28+
```
29+
30+
#### Props
31+
| Prop | Type | Description |
32+
|---|---|---|
33+
|**`cacheExpiration`**|`number`|Expiration in number of milliseconds. This will clear the one request sendt via the resolver (_Default: 500_)|
34+
|**`removeProjection`**|`boolean`|Remove projection, this will request fields on the requested document and put it to cache (_Default: true_)|
35+
|**`debug`**|`boolean`|Enable debug? (_Default: false_)|
36+
37+
### License
38+
=======
39+
[MIT](https://github.com/nodkz/graphql-compose-mongoose/blob/master/LICENSE.md)

0 commit comments

Comments
 (0)