Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/j-hoplin/graphql-crud-playground
Simple GraphQL Schema example
https://github.com/j-hoplin/graphql-crud-playground
apollographql graphql
Last synced: 14 days ago
JSON representation
Simple GraphQL Schema example
- Host: GitHub
- URL: https://github.com/j-hoplin/graphql-crud-playground
- Owner: J-Hoplin
- Created: 2023-03-22T14:19:11.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-30T01:54:41.000Z (over 1 year ago)
- Last Synced: 2024-01-15T21:58:45.828Z (11 months ago)
- Topics: apollographql, graphql
- Language: TypeScript
- Homepage:
- Size: 4.84 MB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
GraphQL CRUD
===
***
- Simple GraphQL CRUD playground using in-memory array
- This repository is a reference repository for my presentation on GraphQL during class (종합설계, [Prof. 김병서](http://bcnlab.hongik.ac.kr/professor.html))
***
**About GraphQL : https://velog.io/@hoplin/GraphQL**
***
# GraphQL Query, Mutation, Object used in Playground
```graphql# Root Type : Query
type Query{
getProduct(id: ID!): [Product!]!
getManager(id: ID!): [Manager!]!
getAllProduct:[Product!]!
getAllManagers:[Manager!]!
}# Root Type : Mutation
type Mutation{
addManager(input: ManagerInput):MutationResponse!
addProduct(input: ProductInput): MutationResponse!
updateProduct(update: UpdateProductInput): MutationResponse!
updateManager(update: UpdateManagerInput) : MutationResponse!
deleteProduct(del: DeleteProductInput): MutationResponse!
deleteManager(del: DeleteManagerInput): MutationResponse!
}# Object : Manager
type Manager{
id: ID!,
name: String!,
age: Int!,
sex: Sex!,
managingProducts:[Product!]!
checkMyProduct(id:String!):Product!
}# Object : Product
type Product {
id: ID!,
type: ProductType!,
name: String!,
price: Int!,
description: String!
managerid: String!
discountedPrice(rate:Int!):Int!
managerInfo:Manager!
}```
- Resolvers exis in [here](./src/Resolver/)
***
# Playground Architecture![img](./img/4.png)
***
# Let's build playground!
First clone project and convert directory to playground source code directory!
```bash
git clone https://github.com/J-hoplin1/GraphQL-CRUD-Playground.gitcd GraphQL-CRUD-Playground
```## Using Docker-Compose!
### Prerequisite
- Docker
- Git
- Docker Compose### Let's move on
1. Build docker compose image```bash
docker compose up -d
```2. Connect to localhost
```
localhost:4000
```
# Playground Schema Relation### 1(Manager) : N(Product)
![img](./img/5.png)