This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Start imports for React Apollo GraphQL Queries | |
import { ApolloProvider } from 'react-apollo'; | |
import { ApolloClient } from 'apollo-client'; | |
import { createHttpLink } from 'apollo-link-http'; | |
import { InMemoryCache } from 'apollo-cache-inmemory'; | |
// End of imports for React Apollo GraphQL Queries | |
// Start imports for GraphQL Hooks Queries | |
import { GraphQLClient, ClientContext } from 'graphql-hooks'; | |
import memCache from 'graphql-hooks-memcache'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const api = require('./server/api'); | |
const typeDefs = require('./server/schema'); | |
const resolvers = { | |
Query: { | |
countries: () => api.countries, | |
country: (obj, args) => { | |
for (const record of api.countries) { | |
if (record.id === args.id) { | |
return record; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { gql } = require('apollo-server'); | |
const typeDefs = gql` | |
type Country { | |
name: String! | |
population: String! | |
inNato: Boolean! | |
id: Int! | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import '../styles/App.css'; | |
import { Query } from 'react-apollo' | |
import gql from 'graphql-tag' | |
const countiresQuery = gql` { | |
countries { | |
name | |
population |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Query } from 'react-apollo' | |
import gql from 'graphql-tag' | |
const countiresQuery = gql` { | |
countries { | |
name | |
population | |
inNato | |
} | |
}` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import './styles/index.css'; | |
import App from './components/App'; | |
import * as serviceWorker from './serviceWorker'; | |
import { ApolloProvider } from 'react-apollo'; | |
import { ApolloClient } from 'apollo-client'; | |
import { createHttpLink } from 'apollo-link-http'; | |
import { InMemoryCache } from 'apollo-cache-inmemory'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const resolvers = { | |
Query: { | |
books: () => api.books, | |
countries: () => api.countries | |
}, | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { gql } = require('apollo-server'); | |
const typeDefs = gql` | |
type Book { | |
title: String | |
author: String | |
} | |
type Country { | |
name: String | |
population: String |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Import of the file where we build data structures/schemas | |
const typeDefs = require('./server/schema'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const api = { | |
books: [ | |
{ | |
title: 'Encyklopedia PWN - A-D', | |
author: 'Instytut Przyszłości', | |
}, | |
{ | |
title: 'Encyklopedia PWN - E-G', | |
author: 'Instytut Przyszłości', | |
}, |