Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/johnrazeur/generator-graphql-typescript
Create an awesome GraphQL API with typescript
https://github.com/johnrazeur/generator-graphql-typescript
generator-graphql-typescript graphql graphql-api typegraphql-typeorm typescript
Last synced: 4 months ago
JSON representation
Create an awesome GraphQL API with typescript
- Host: GitHub
- URL: https://github.com/johnrazeur/generator-graphql-typescript
- Owner: johnrazeur
- Created: 2019-07-14T21:48:00.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T20:52:16.000Z (about 2 years ago)
- Last Synced: 2024-10-01T16:27:12.146Z (5 months ago)
- Topics: generator-graphql-typescript, graphql, graphql-api, typegraphql-typeorm, typescript
- Language: TypeScript
- Size: 1.12 MB
- Stars: 6
- Watchers: 1
- Forks: 2
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
Awesome Lists containing this project
README
# generator-graphql-typescript [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coverage percentage][coveralls-image]][coveralls-url]
> Create a Graphql API in typescript with [type-graphql](https://typegraphql.ml/) and [Typeorm](https://typeorm.io/#/)
## Installation
First, install [Yeoman](http://yeoman.io) and generator-rest-express-typescript using [npm](https://www.npmjs.com/) (we assume you have pre-installed [node.js](https://nodejs.org/)).
```bash
npm install -g yo
npm install -g generator-graphql-typescript
```Then generate your new project:
```bash
yo graphql-typescript myapp
```
## Getting Started* Run `npm start` to preview and watch for changes
* Run `npm run build` to create the production version
* Run `npm run test` to lauch jest test## Queries
### Login
```graphql
query login(
input: $input
) {
... on LoginType {
__typename
token
}
... on UserError {
__typename
message
}
}
}
```### Get projects
You need to put the token you get from the login query to perform this query. Prefix the authorization header with `bearer`.
```json
{
"Authorization": "bearer thetoken"
}
``````graphql
query {
projects {
name,
owner { email }
}
}
```## Mutations
### Register
```graphql
mutation {
register(
input: $input
) {
... on User {
__typename
username
}
... on UserError {
__typename
message
}
}
}
```### Add project
You need to put the token you get from the login query to perform this query. Prefix the authorization header with `bearer`.
```json
{
"Authorization": "bearer thetoken"
}
``````graphql
mutation {
createProject(
input: $input
) {
__typename
... on Project {
name
}
... on UserError {
message
}
}
}
```## TODO 🚧
* Add subcommand to create a new resolver
## Contribute
See the [contributing docs](contributing.md).
## License
MIT © [Clément Lafont]([email protected])
[npm-image]: https://badge.fury.io/js/generator-graphql-typescript.svg
[npm-url]: https://npmjs.org/package/generator-graphql-typescript
[travis-image]: https://travis-ci.org/johnrazeur/generator-graphql-typescript.svg?branch=master
[travis-url]: https://travis-ci.org/johnrazeur/generator-graphql-typescript
[coveralls-image]: https://coveralls.io/repos/johnrazeur/generator-graphql-typescript/badge.svg
[coveralls-url]: https://coveralls.io/r/johnrazeur/generator-graphql-typescript