Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add npm script for running an example #1461

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ All examples has a `examples.gql` file with sample queries/mutations/subscriptio
> **Note**: Be aware that the examples on master branch are designed to work with latest codebase that might not be released yet.
> So if you are looking for examples that are compatible with the version you use, just browse the files by the git tag, e.g. [`tree/v0.16.0` for `0.16.0` release](https://github.com/MichalLytek/type-graphql/tree/v0.16.0/examples).

## Run an example server

```bash
# Replace "simple-usage" with the directory name of the example you want to run
npm run example --example=simple-usage
```

## Basics

- [Simple usage of fields, basic types and resolvers](./simple-usage)
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"package": "echo TODO: bash script",
"docs": "npm run --prefix website start",
"generate:sponsorkit": "npx sponsorkit --width=320 --dir=./img --name=github-sponsors",
"postgenerate:sponsorkit": "npx shx cp ./img/github-sponsors.svg ./website/static/img/github-sponsors.svg"
"postgenerate:sponsorkit": "npx shx cp ./img/github-sponsors.svg ./website/static/img/github-sponsors.svg",
"example": "ts-node ./examples/${npm_config_example}/index.ts"
},
"peerDependencies": {
"graphql": "^16.6.0",
Expand Down