https://github.com/idkjs/swapi-dataloader
https://github.com/idkjs/swapi-dataloader
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/idkjs/swapi-dataloader
- Owner: idkjs
- Created: 2020-05-16T21:35:07.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-06T02:57:08.000Z (over 2 years ago)
- Last Synced: 2025-02-04T16:51:14.332Z (5 months ago)
- Language: JavaScript
- Homepage:
- Size: 526 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# dataloader-codegen Example: Star Wars API (SWAPI)
Shows an example of a GraphQL Server using dataloader-codegen. Prints data from https://swapi.dev.
## Try it out locally!
Clone dataloader-codegen and build locally:
```sh
$ git clone [email protected]:Yelp/dataloader-codegen.git
$ cd dataloader-codegen
$ make build
$ yarn link
```Build the example:
```sh
$ cd examples/swapi
$ yarn
$ yarn link dataloader-codegen
$ make swapi-loaders.js
$ make build
# Prints out a GraphQL query result:
$ node build/swapi-server.js
```## File Layout:
- `swapi-loaders.js`: An autogenerated file by dataloader-codegen. Contains the codegen'd dataloaders. (Checked in to git so folks can easily see an example of the generated code).
- `swapi.js`: A set of functions to fetch data from https://swapi.dev/. This is analogous to a library generated by openapi-generator/swagger-codegen.
- `swapi-server.js`: The dummy GraphQL server! This imports the dataloaders from swapi-loaders.js. At present, it just prints the result of a query to stdout.