File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ [
2+ {
3+ "id" : " 1" ,
4+ "nombre" : " Jorge Mendez Ortegs" ,
5+ "cuerpo" : " Comentario loco"
6+ }
7+ ]
Original file line number Diff line number Diff line change 1+ [
2+ {
3+ "id" : 1 ,
4+ "titulo" : " Curso 1" ,
5+ "descripcion" : " Esto es el cuso 1" ,
6+ "raiting" : 0.5
7+ },
8+ {
9+ "id" : 2 ,
10+ "titulo" : " Curso 2" ,
11+ "descripcion" : " Esto es el cuso 2" ,
12+ "raiting" : 0.5
13+ },
14+ {
15+ "id" : 3 ,
16+ "titulo" : " Curso 3" ,
17+ "descripcion" : " Esto es el cuso 3" ,
18+ "raiting" : 0.5
19+ }
20+ ]
Original file line number Diff line number Diff line change 1+ {
2+ "id" : " 1" ,
3+ "nombre" : " Jorge Mendez" ,
4+ "nacionalidad" : " Mexicana"
5+ }
Original file line number Diff line number Diff line change 1+ import MockCursos from "./Cursos.json" ;
2+ import MockComentarios from "./Comentarios.json" ;
3+ import MockProfesores from "./Profesores.json" ;
4+
5+ export {
6+ MockComentarios ,
7+ MockCursos ,
8+ MockProfesores ,
9+ } ;
Original file line number Diff line number Diff line change 22// constante se genere como un schema
33import { makeExecutableSchema } from "graphql-tools" ;
44
5+ // mockups
6+ import { MockComentarios , MockCursos , MockProfesores } from "./mockups" ;
7+
58// Creacion del schema, es importante declarar
69// el Query root ya que este indica el endpoint
710const TYPE_DEF = `
@@ -47,12 +50,30 @@ const TYPE_DEF = `
4750 }
4851` ;
4952
53+ /**
54+ * Declarando la capa de datos que utilizara resoler.
55+ */
56+ const RESOLVERS = {
57+ Query : {
58+ cursos : ( ) => MockCursos ,
59+ } ,
60+ Curso : {
61+ profesor : ( ) => MockProfesores ,
62+ comentarios : ( ) => MockComentarios ,
63+ } ,
64+ Profesor : {
65+ cursos : ( ) => MockComentarios ,
66+ genero : ( ) => "MASCULINO" ,
67+ } ,
68+ } ;
69+
5070/**
5171 * Permite que el esquema declarado se tradusca
5272 * a un esquema de GQL
5373 */
5474const SCHEMA = makeExecutableSchema ( {
5575 typeDefs : TYPE_DEF ,
76+ resolvers : RESOLVERS ,
5677} ) ;
5778
5879export default SCHEMA ;
You can’t perform that action at this time.
0 commit comments