https://github.com/antoniopresto/sociall
https://github.com/antoniopresto/sociall
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/antoniopresto/sociall
- Owner: antoniopresto
- Created: 2017-09-19T01:29:13.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-22T05:39:59.000Z (over 2 years ago)
- Last Synced: 2025-01-31T01:53:18.693Z (4 months ago)
- Language: JavaScript
- Size: 868 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GraphQL DataLoader Boilerplate
[](https://circleci.com/gh/entria/graphql-dataloader-boilerplate)
[](https://codecov.io/gh/entria/graphql-dataloader-boilerplate)Very simple boilerplate using GraphQL and DataLoader
## Blog Posts
* [How to implement viewerCanSee in GraphQL](https://medium.com/@sibelius/how-to-implement-viewercansee-in-graphql-78cc48de7464#.d9vpk6fvx)
* [Testing a GraphQL Server using Jest](https://medium.com/@sibelius/testing-a-graphql-server-using-jest-4e00d0e4980e)### Directory Structure
```
├── /data/ # GraphQL generated schema
├── /repl/ # Read-Eval-Print-Loop (REPL) configuration
├── /scripts/ # Generate GraphQL schema script
├── /src/ # Source code of GraphQL Server
│ ├── /connection/ # Connections types (Relay)
│ ├── /interface/ # NodeInterface (Relay)
│ ├── /loader/ # Loaders of the models using DataLoader
│ ├── /model/ # Models definition (Mongoose, SQL, Google DataStore)
│ ├── /mutation/ # Mutations definition
├── /test/ # Test helpers
```## Create-GraphQL
If you want to move faster you should use [create-graphql](https://github.com/lucasbento/create-graphql) to simplify the creation of a GraphQL Server## Command
#### Setup
```bash
npm install
```
Note: If you do not have mongodb installed, please install it:
```bash
brew install mongodb
```
#### Develop
```bash
npm run watch
```### Test
```bash
npm test
```Or
```bash
npm run test:watch
```#### Docker and docker-compose
No needs for installing dependencies or running `mongod` in another terminal window```bash
docker-compose build && docker-compose up
```Test
```bash
docker-compose -f docker-compose.test.yml build && docker-compose -f docker-compose.test.yml up
```#### Production
```bash
# first compile the code
npm run build# run graphql compiled server
npm start
```### Flow
```bash
npm run flow
```Or
```bash
flow
```### REPL server
```bash
npm run replawesome > const user = await M.User.find()
```Yep, await syntax works on the repl, it is awesome, tks @princejwesley (https://gist.github.com/princejwesley/a66d514d86ea174270210561c44b71ba)
### Schema
Update your schema
```bash
npm run update-schema
```Take a look on the [Schema](https://github.com/sibelius/graphql-dataloader-boilerplate/blob/master/data/schema.graphql)