Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/matheustanaka/challengeGraphql
CRUD using Graphql, Apollo server and Mongodb.
https://github.com/matheustanaka/challengeGraphql
apollo-server database graphql mongodb nodejs
Last synced: 8 days ago
JSON representation
CRUD using Graphql, Apollo server and Mongodb.
- Host: GitHub
- URL: https://github.com/matheustanaka/challengeGraphql
- Owner: matheustanaka
- Created: 2021-06-04T02:07:47.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-10-16T22:37:24.000Z (about 1 month ago)
- Last Synced: 2024-10-18T22:48:56.889Z (29 days ago)
- Topics: apollo-server, database, graphql, mongodb, nodejs
- Language: JavaScript
- Homepage:
- Size: 839 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Challenge Graphql
CRUD using graphql, apollo server and mongodb.
## Getting Started
---
# MongoDB
- You have to create a database or just use your database in Docker (only MongoDB).# install dependencies
$ yarn install# start project
$ yarn dev# see graphql interface on localhost link
http://localhost:4001/graphql## Queries
---
- Create User
mutation {
createUser(data: {
firstName: "Matheus",
lastName: "Tanaka",
email: " [email protected]"
active: true
}) {
_id
firstName
lastName
}
}- Query User
query {
users {
_id
firstName
lastName
fullName
active
}
}- Delete User
mutation{
deleteUser(id: "60b9753dcf587036e0008644")
}- Update User
mutation {
updateUser (id: "60b9753dcf587036e0008644", data: {
firstName: "Matheus3333",
lastName: "Tanaka",
email: "[email protected]"
active: true
}) {
_id
firstName
lastName
}
}* Create Post
mutation {
createPost(data:{
title: "Testing 2 other poster",
content: "testing",
author: "60b9753dcf587036e0008644"
}) {
_id
title
content
author{
fullName
_id
}
}
}* Query Post
query {
posts {
_id
title
content
author {
fullName
}
}
}* Delete Post
mutation {
deletePost(id: "60b97f8694a07035382d075d")
}* Update Post
mutation {
updatePost(id: "60b97ff238ad2b1444c36f97", data:{
title: "Updating my second post",
content: "testing",
author: "60b9753dcf587036e0008644"
}) {
_id
title
content
author{
_id
fullName
}
}
}