Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vydyas/graphql-express-node-docker-json
Writing a GraphQL CRUD application with NodeJS, Express without database. Easily Deployable with docker.
https://github.com/vydyas/graphql-express-node-docker-json
chai docker docker-com dockerfile express fsevent graphql hacktoberfest hacktoberfest2020 json logging mocha morgan nodejs supertest swagger winston winston-logger winston-transport
Last synced: about 1 month ago
JSON representation
Writing a GraphQL CRUD application with NodeJS, Express without database. Easily Deployable with docker.
- Host: GitHub
- URL: https://github.com/vydyas/graphql-express-node-docker-json
- Owner: vydyas
- License: apache-2.0
- Created: 2019-10-03T19:31:30.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-10-07T06:25:48.000Z (about 5 years ago)
- Last Synced: 2024-04-08T17:33:30.104Z (9 months ago)
- Topics: chai, docker, docker-com, dockerfile, express, fsevent, graphql, hacktoberfest, hacktoberfest2020, json, logging, mocha, morgan, nodejs, supertest, swagger, winston, winston-logger, winston-transport
- Language: JavaScript
- Homepage:
- Size: 22.5 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Graphql Nodejs application with express and JSON Files
I made this application with lot of interest and to help opensource society to use this as
boilerplate to kick start their projects.## What about testcases?
I integrated with ```Mocha``` ```chai``` to test our code.
## How to start this application?
If you have Nodejs installed machine then follow below steps?
```sh
npm installnpm run dev:api
```## We ship our code through Docker.
Just enter below command to spin container
```sh
docker-compose up
```### Create a Owner
```sh
mutation CreateOwner($input: CreateOwnerInput!){
createOwner(input:$input){
id
name
address
mobile
}
}
```### Create a Owner along with pet if it is available
```sh
mutation CreateOwner($input: CreateOwnerInput!){
createOwner(input:$input){
id
name
address
mobile
pet:[Int]
}
}
```### Getting Owners along with pets
```sh
query Owners {
owners{
id
name
address,
mobile,
pets {
name
}
}
}
```### Getting Owners only
```sh
query Owners {
owners{
id
name
address,
mobile
}
}
```### Updating Owner
```sh
mutation UpdateOwner($id: Int!, $input: CreateOwnerInput!) {
updateOwner(id: $id, input: $input) {
id
name
address
mobile
}
}
```
### Deleting Owner```sh
mutation DeleteOwner($id: Int!){
deleteOwner(id: $id){
message
}
}
```### Update Pet
```sh
mutation UpdatePet($id:Int!, $input: CreatePetInput!) {
updatePet(id: $id, input: $input){
id
name
breed
colour
age
}
}
```
### Input for Owner and Pets```sh
{
"input": {
"name":"Siddhu",
"email":"[email protected]",
"address": "Hyderabad",
"mobile": "+91-9581594325"
}
}{
"id": 1,
"input": {
"name":"Siddhu",
"email":"[email protected]",
"address": "Hyderabad",
"mobile": "+91-9581594325",
"pets":[1,2]
}
}{
"input": {
"name":"Kicchu",
"breed": "Persian",
"age": 10,
"colour": "red"
}
}{
"id": 1,
"input": {
"name":"chakki",
"breed": "Persian",
"age": 10,
"colour": "red"
}
}
```