Code Monkey home page Code Monkey logo

graphql-academia-online's Introduction

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"
	}
}

graphql-academia-online's People

Contributors

nimrockdev avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.