Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Nimrockdev/graphQL-academia-online

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GraphQL whith Apollo server 2

In docs you can see that the data can be returned to us in the different queries and mutations.

Create 'tsconfig.json'

npx tsc --init --rootDir src --outDir build --lib dom,es6 --module commonjs --removeComments --target es6 --resolveJsonModule true

Production dependencies

npm install express graphql ncp http graphql-import-node compression cors lodash typescript graphql-tools graphql-playground-middleware-express apollo-server-express

Development dependencies

npm install @types/compression @types/express @types/cors @types/lodash @types/node @types/graphql -D

npm install graphql-depth-limit

Dependencies for deployment ZEIT

npm install graphql-tag-pluck

URL

Inspect: https://02-academi-online-new.now.sh/

Production: https://zeit.co/jsg8405/02-academi-online-new/nvv19zd60

Postman Documentation https://documenter.getpostman.com/view/4424097/SztBb7yX

Query Examples

{
  estudiantes{
    id
    name 
    email
    website
    courses{
      id
      title
      description
      clases
    }
  }
}  

{
  cursos {
    id
    title
    teacher
  }
}	

query getCourse($id: ID!){
    course(id: $id) {
	id
	title
	clases
	logo
	level
	path
	time
	students {
	    id
	    name
	    email
	}
    }
}

Mutation with variables

mutation nuevoCurso($curso: CursoInput!) {
      cursoNuevo(curso: $curso) {
	    id
	    description
	    title
      }
}


{
    "curso": {
    "title": "GraphQL",
    "description": "test",
    "clases": 25,
    "time": 45,
    "logo": "",
    "path": "",
    "level": "EXPERTO",
    "teacher": "Yo"
      
    }
}



mutation modificarCurso($curso: CursoInput!) {
    modificarCurso(curso: $curso) {
	    id
	    description
	    title
	    clases
    }
}

{
"curso": {
    "id": "5",
    "title": "GraphQL  ",
    "description": "test",
    "clases": 255,
    "time": 45,
    "logo": "",
    "path": "",
    "level": "EXPERTO",
    "teacher": "Yo"
	}
}

About

GraphQL project, deployed heroku

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published